--- [EMAIL PROTECTED] wrote:
> I need a little help querying 2 tables in MySQL;
> 
> Table User
>  User_Id   // Id = 2
>  User_Name // John
> 
> Table History
> User_Id  // 2
> User_History // John has born in 58
> 
> SELECT User_History FROM History WHERE User_Id = 2;  // return John has
> born in 58
> 
> But what my SELECT should look if i don't know the user id and want search
> the User_History by the User_Name?
> 
> SELECT User_History FROM History WHERE User_Id = ( SOMEWAY TO DATABASE FIND
> JOHN ID BY JOHN NAME  )

I am no MySQL expert by any means, but I believe that a sub select would handle
it. However, last I knew MySQL didn't support them. So I believe the other
solution would be to do a JOIN, I thought I remembered people here saying that
JOINs are the sub-select work around. Seeing as how I do not know them at all I
can't offer an example... Sorry

If this is incorrect someone please correct me.

Thanx,
Ryan

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

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