|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
|||
|
|||
|
join query
Hi! I have the following two simple, normalized tables:
assocs association_id | ud_id | client_id updates ud_id | ud_date | ud_text I'm using PHP and MySQL. My ultimate goal is to print the updates relevant to a specific client. When the client comes to the page that contains the join, the client_id variable already has a value (from when the client logged in). I want to (a) get the ud_id's associated with the client_id, and then be able to echo() the ud_date and ud_text that correspond to those ud_id's. Based on what I've gotten from the MySQL manual, a book, and articles, this is what I've come up with the following, which still doesn't account for filtering by client_id's: query="SELECT u.ud_date, u.ud_text FROM cu_assocs AS c, updates AS u WHERE c.client_id = u.client_id"; Anyone have any idea how I can modify this statement to accomplish this goal? Thanks! James |
|
#2
|
|||
|
|||
|
SELECT up.ud_date, up.ud_text FROM assocs AS as INNER JOIN updates AS up ON as.ud_id = up.ud_id WHERE as.client_id = PUT YOUR PRESET VARIABLE HERE;
uh.. or something like that? gah, I'm tired.. almost 9 am, have to get some sleep ![]()
__________________
Best Regards, Håvard Lindset |
|
#3
|
|||
|
|||
|
thanks!
Thanks, Håvard,
I think my main problem was lack of sleep, too! And i was doing it the old way instead of the ANSI way. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > General SQL Development > join query |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|