I have two tables: user and library. The library contains books sorted in a specific way; the user can choose to sort their books in a specific way. the structure (and sample data) for the two tables will look like this:
Library
bookid position
10 1
12 2
14 3
16 4
user
userid bookid position 12669
1
12669 2
I want the query to return all books for the user, 12669, sorted by ie:
select bookid from the user, where userid = 12669 group by position
After he returns these sorted books, he should return other books (not present in the user) that are in the library. No brochure should be repeated. The result of this script will look like this:
12
10
14
16
: ,
, , user.position
, - . :
bookid u right join library l u.bookid = l.bookid, u.userid = 12669 u.position
. ""? .