0

I have such database query, which works well in MySQL:

select authors.name, authors.surname, books.name, publishers.name, copies.comment 
from authors, books, publishers, copies
where (authors.id, books.id) in (select authorship.author_id, authorship.book_id from authorship)   
and (books.id, publishers.id, copies.publish_id) in (select publishment.book_id, publishment.publisher_id, publishment.id from publishment);

In SQLite database I've got such error on part "where (authors.id, books.id) in":

Error: near ",": syntax error

Is it possible to make such type of query in SQLite (maybe - with different syntax)?

PS: I know that using joins is better for those case, but I want to know if it is possible for general knowledge.

1 Answer 1

1

I know that using joins is better for those case, but I want to know if it is possible for general knowledge.

No, this is not possible. Use explicit joins.

SELECT
  a.name, a.surname, b.name, p.name, c.comment 
FROM
  authors                a
  INNER JOIN authorship ab ON ab.author_id = a.id
  INNER JOIN books       b ON b.id         = ab.book_id
  INNER JOIN publishment p ON p.book_id    = b.book_id
  INNER JOIN copies      c ON c.publish_id = p.id

(And by the way, you should do the same for mySQL)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.