Jump to content

Multiple "Where" values in a query.


Andy11548

Recommended Posts

I need this query to select 2 different pieces of information from the database using a $_GET method. But how do I make it so that I can have more than one WHERE?

 

SELECT
				 f1.cat_id as CatID,
				 f1.cat_name as CatName,
				 f2.sub_id as SubID,
				 f2.sub_name as SubName

				 FROM

				 forum_cats as f1
				 	LEFT JOIN forum_sub as f2
				 		ON f1.cat_id = f2.cat_id

				 WHERE f1.cat_id = '$cat'

 

I need it to also do

 

WHERE f2.sub_id = '$sub'

 

I tried using the AND feature, but it doesn't work how I want it too.

 

Thanks in advance,

Andy.

Link to comment
https://forums.phpfreaks.com/topic/258206-multiple-where-values-in-a-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.