View Single Post
Old 09-30-2003, 07:37 PM  
Lane
Will code for food...
 
Join Date: Apr 2001
Location: Buckeye, AZ
Posts: 8,496
Quote:
Originally posted by magnatique
Hey there...


I am trying to figure out the best way to do this...


right now, I do one query where I gather the info needed to build the page...


basically, it returns 4 rows, and with each mysql_fetch_row, I build a html table to display an update... (example, it would build the page listing girl1, girl2, girl3, girl4 with her info such as description, name, etc...)


NOW, I need to test each of these girls against ANOTHER table in mysql database. Unfortunately, I cannot combine the field of that table directly in the same table as the original one, since it's totally different data...

it would basically be a simple query like

SELECT update_info.girl,surfer_behavior.clicks
FROM update_info left join surfer_behavior
on update_info.girl = surfer_behavior.girl;


But, if I split the queries like that, I would have to run the last query 4 times for each girl inside the loop that builds the page, as I need to include that data in order to build the one girl's table...
(basically, I would test if surfer_behavior.clicks < 100, don;t display 'congrats')


What I am wondering is if there's any way you MYSQL gurus might know for me to Sort of JOIN these two queries together with the first one...


in other words, how do I add this to the original query : "and if votes.clicks >100 for current girl in this row, add a column named 'test' that says true"



I dont understand the part where you say you have to run the query 4 times...


you can get all the data with a single query.. like this:

select update_info.girl, update_info.blah, update_info.huh, update_info.something, surfer_behavior.clicks .....

etc..
__________________
Lane is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote