Допустим, у меня есть 2 таблицы:
курсы
| id | name | is_sort_by_borrower |
|----|--------------|---------------------|
| 1 | Comp Science | 1 |
| 2 | Biz Admin | 0 |
| 3 | Physics | 1 |
книги
| id | title | borrower | last_borrow_date | course_id |
| --- | ------ | -------- | ---------------- | --------- |
| 1 | Book A | 523 | 11/12/19 12:33 | 1 |
| 2 | Book B | 423 | 11/15/19 12:33 | 1 |
| 3 | Book C | 401 | 10/22/19 12:33 | 1 |
Естьстолбец is_sort_by_borrower
в курсах , я хочу получить такой результат
| course | book_title | borrower | last_borrow_date | is_sort_by_borrower |
|--------------|------------|----------|------------------|---------------------|
| Comp Science | Book A | 523 | 11/12/19 12:33 | 1 |
| Comp Science | Book B | 423 | 11/15/19 12:33 | 1 |
| Comp Science | Book C | 401 | 10/22/19 12:33 | 1 |
| Comp Science | Book D | 377 | 11/19/19 12:33 | 1 |
| Biz Admin | Book E | 122 | 11/20/19 12:33 | 0 |
| Biz Admin | Book F | 419 | 11/12/19 12:33 | 0 |
| Biz Admin | Book G | 65 | 10/18/19 12:33 | 0 |
| Physics | Book H | 446 | 8/31/19 12:33 | 1 |
| Physics | Book I | 398 | 11/2/19 12:33 | 1 |
| Physics | Book J | 376 | 9/30/19 12:33 | 1 |
| Physics | Book K | 249 | 10/11/19 12:33 | 1 |
Можно ли отсортировать результат по borrower
, по last_borrow_date
?