Hill, Keith wrote:
I am converting an Access95 DB to mySQL. The interface will remain in Access95.  I encountered a problem with one of the existing queries.  The code for the query is:

SELECT DISTINCTROW ManualChecksPrinted.AccountNum, ManualChecksPrinted.CheckNumber, ManualChecksPrinted.AccountID, ManualChecksPrinted.PayeeID, ManualChecksPrinted.CheckPayee, ManualChecksPrinted.CheckDate, ManualChecksPrinted.CheckAmount
FROM ManualChecksPrinted
WHERE (((ManualChecksPrinted.AccountNum) In (SELECT [AccountNum] FROM [ManualChecksPrinted] As Tmp GROUP BY [AccountNum],[CheckNumber] HAVING Count(*)>1  And [CheckNumber] = [ManualChecksPrinted].[CheckNumber])))
ORDER BY ManualChecksPrinted.AccountNum, ManualChecksPrinted.CheckNumber;

The problem is in the WHERE clause.  I get the ODBC--call failed message box, and the following:

[MySQL][ODBC 3.51 Driver][mysqld-4.0.17-nt]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 `MS2`.`AccountNum` FROM `manualchecksprinted` `MS2` GR (#1064)

I am a newbie to MySQL so all help is greatly appreciated.  If more information is required, please let me know.

Keith Hill 
[EMAIL PROTECTED] 
  
You're using a subquery, which Access is passing through to MySQL.
MySQL-4.0.17 doesn't support subqueries - only version 4.1.x and higher do.
Make another query, put the stuff in the subquery in it - that's the bit that says:

in ( select ........ )

Save it, and then join it to your original query.

Dan

--
signature Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: [EMAIL PROTECTED]
website: http://www.nusconsulting.com.au
-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to