Hello: I am new to this and am having trouble with subqueries.
Using MySQL 3.23 I have a Contacts table, and a Users table each with a ContactId field. I want to retrieve the ContactID from the Users table where UserName and UserPassword are such and such, I then want to get the FirstName and LastName from the Contacts table with the matching ContactId. The two SELECTS work fine individually and if I manually supply the first SELECT with the result of the SELECT in the subquery, I get the correct result. But I get a syntax error when I combine them. Can anyone suggest where I am fouling up? Here is the query: SELECT Contacts.FirstName, Contacts.LastName FROM Contacts WHERE Contacts.ContactId = (SELECT Users.ContactId FROM Users WHERE Users.UserName = 'Doug' AND Users.UserPassword = 'Crock'); Thanks David --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php