You are here: how to have these two consequent queries become a single one by 'join' in mysql « PHP Programming Language « IT news, forums, messages
how to have these two consequent queries become a single one by 'join' in mysql

Posted by newbie on 07/22/07 18:52

--------------------------------------------------------- table_info
| id | age | first_name | last_name |
---------------------------------------------------------
| 10 | 21 | tom | ben |
---------------------------------------------------------

---------------------------------------------------------
table_working_hr
| id | coming_date | work_hour |
---------------------------------------------------------
10 | 12 | 4 |
---------------------------------------------------------
10 | 11 | 4 |
---------------------------------------------------------
10 | 22 | 6 | <-------the
will be the final result.
---------------------------------------------------------


$result= mysql_query(" select * from table_info where first_name =
'tom' ");
$id = $result['id'];
mysql_query(" select * from table_working_hr where id='$id' AND
coming_date > 20 ");

Can I get the result with a single query (with some advanced query
like join )?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация