Wouldn't

SELECT Contacts.FirstName, Contacts.LastName FROM Contacts, Users WHERE
    Users.UserName = 'Doug' AND
    Users.UserPassword = 'Crock' AND
    Contacts.ContactId = Users.ContactId;

work?

Daniel

At 16:28 30.07.02 +0100, you wrote:
>Forget it (at least for the forseeable future)
>
>This is the well known MySQL feature that means that MySQL is not even SQL
>compatible. Argghhhh. Apparently you will have to wait for version 4.1.
>
>Subqueries are not supported ....
>
>Jeff
>
>----- Original Message -----
>From: <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Tuesday, July 30, 2002 3:55 PM
>Subject: subquery syntax
>
>
> > 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
> >
> >
>
>
>
>---------------------------------------------------------------------
>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


---------------------------------------------------------------------
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

Reply via email to