SQL Query Syntax Error
Hello The following query used to work when I was using an Access database, but now that I've moved to MySQL I get a syntax error when I try and run it: SELECT *, (SELECT COUNT (*) FROM Links WHERE Links.CAT_ID = Categories.CAT_ID AND LINK_APPROVED = 'Yes') AS LINK_COUNT FROM Categories ORDER BY CAT_NAME ASC The error message is this: SQLState: 42000 Native Error Code: 1064 [TCX][MyODBC]syntax error near 'SELECT COUNT (*) FROM Links WHERE Links.CAT_ID = Categories.CAT_ID AND LINK_AP' at line 1 Any immediate reactions? Thanks in advance for any help you can give me... Best wishes Trevor Sather
RE: SQL Query Syntax Error
Trevor Sather wrote: > Hello > > The following query used to work when I was using an Access database, > but now that I've moved to MySQL I get a syntax error when I try and > run it: > > SELECT *, (SELECT COUNT (*) > FROM Links > WHERE Links.CAT_ID = Categories.CAT_ID AND LINK_APPROVED = 'Yes') AS > LINK_COUNT FROM Categories ORDER BY CAT_NAME ASC > > The error message is this: > > SQLState: 42000 > Native Error Code: 1064 > [TCX][MyODBC]syntax error near 'SELECT COUNT (*) FROM Links WHERE > Links.CAT_ID = Categories.CAT_ID AND LINK_AP' at line 1 > > Any immediate reactions? Thanks in advance for any help you can give > me... What version are you using? Sub-selects only became available in MySQL 4.1 (I think). -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]