Can anyone advise where i'm going wrong with the syntax here please?
I have this query which returns 26 rows
SELECT firstname, lastname
FROM author
WHERE authorid IN (
SELECT authorid
FROM written_by
JOIN book ON written_by.bookdescid = book.bookdescid
WHERE UPPER (book.title) LIKE UPPER ('%electric%')
AND NOT UPPER (written_by.role) LIKE UPPER('%translator%'));
This appears to be correct and the reason I am using UPPER and ('%example%') like this is for variations in capitalization.
However, when I try and add into the query to also pick up where the book subtitle also includes 'electric' I am somehow getting the syntax wrong as it returns less rows? If anything it should be the same or more... I've tried a few variations but this one below is what i thought would work..
SELECT firstname, lastname
FROM author
WHERE authorid IN (
SELECT authorid
FROM written_by
JOIN book ON written_by.bookdescid = book.bookdescid
WHERE UPPER (book.title) OR (book.subtitle) LIKE UPPER ('%electric%')
AND NOT UPPER (written_by.role) LIKE UPPER('%translator%'));
select * from t where x or y like 'A'would show the problem is OR vs LIKE. Or OR vs = even smaller.