Hi,
I'm using the following query and it works fine in MySQL 5.0.15-nt on WinXP test setup:
SELECT * FROM tutorials WHERE tutorial_id IN (SELECT tutorial_id FROM permissions WHERE group_id = (SELECT group_id FROM users WHERE user_id = 6))
However, when moved on to my server, MySQL 4.0.25-standard-log, I get the following error:
#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT tutorial_id FROM permissions WHERE group_id = (SELECT
Is this something to do with different implementations of the IN construct or what?
The third nested statement "SELECT group_id FROM users WHERE user_id = 6" works fine and returns an integer. The second statement "SELECT tutorial_id FROM permissions WHERE group_id = ( . . . )" works ok if I stick this integer in manually, but breaks down when used as I need to use it.
I may be barking up the tree with thinking its to do with IN. Could this be accomplished using INNER JOIN's, I haven't really looked into them as this worked before, but are they a similar idea?
Any help with this would be very much appreciated.