[thelist] mysql question

rudy r937 at interlog.com
Wed Oct 16 14:01:01 CDT 2002

>  create temporary table temp (item_id INTEGER)
>  insert into temp (item_id)
>      select item_id from tableA WHERE item_review='$search_term'
>  insert into temp (item_id)
>      select item_id from tableB WHERE description='$search_term'

so far so good

but why do your original queries only go after the item_id, kevin?

surely, after performing a search, you are going to want to retrieve other
table columns in addition to the item_id

i trust you are not going to try retrieving them one row at a time by
looping over the item_ids that the search returns...

the original queries, which go after _different_ tables, should be storing
things like item_name, item_descr, etc., in the temp table

then you can pull everything out of the temp table in one call....


More information about the thelist mailing list