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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.