Query Help!
Posted: Sun Apr 05, 2009 1:06 am
What I'm trying to do is to loop through the database for the possible results based on the previous results and stop until it reaches certain value. I put a simple query and hope that makes sens of what I'm doing here.
1st query - $item_B = SELECT * FROM listings WHERE listings.item_A LIKE '%anyfields%' - this is the query to return item_B
2nd query - $item_C = SELECT * FROM listings WHERE listings.listing_id = $item_B AND listings.item_name LIKE '%fields%' - this is the query to return item C
......keep going
Last query - SELECT * FROM listings WHERE listings.listing_id = $item_C AND listings.item_name LIKE '%fields%' - this is the query to return item Item_A. Once the Item_A matches the Item_A in the 1st query, the query should stop.
I'm not sure how to combine all this queries into one. Since there could be more e items involved in this query.
THANKS.
1st query - $item_B = SELECT * FROM listings WHERE listings.item_A LIKE '%anyfields%' - this is the query to return item_B
2nd query - $item_C = SELECT * FROM listings WHERE listings.listing_id = $item_B AND listings.item_name LIKE '%fields%' - this is the query to return item C
......keep going
Last query - SELECT * FROM listings WHERE listings.listing_id = $item_C AND listings.item_name LIKE '%fields%' - this is the query to return item Item_A. Once the Item_A matches the Item_A in the 1st query, the query should stop.
I'm not sure how to combine all this queries into one. Since there could be more e items involved in this query.
THANKS.