Jump to content

Confusing multiple WHERE statement


TecTao

Recommended Posts

I've joined two tables:

 

SELECT * FROM county_Payment_plan cPp

LEFT JOIN county_Count Count ON ( cPp.countID = Count.cCt_countID )

LEFT JOIN item_dir ID ON ( Count.cCt_countyID = ID.itd_countyID )

 

 

There is a column with State abbreviations, Category Codes and Status Codes. The State abbreviations return all of the state counties.

 

From a previous page, variables are passed state=FL, category code=gp1, status=s

 

I am trying to do a select statement where all Florida counties are returned except those sith "pg1" and "s"  so my where clause is

 

WHERE cCt_stateID = 'FL'

AND itd_status <> 's'

AND `itd_groupPlan` <> 'gp1'

 

Which seem logical, but it returns no results.  Ive tried OR as well.  I also did the opposite to return all those that were 'GP1' and 'S'

 

SELECT * FROM county_Payment_plan cPp

LEFT JOIN county_Count Count ON ( cPp.countID = Count.cCt_countID )

LEFT JOIN item_dir ID ON ( Count.cCt_countyID = ID.itd_countyID )

WHERE cCt_stateID = 'FL' AND itd_status = 's' AND `itd_groupPlan` = 'gp1'

 

Any ideas on the how to get all counties that don't have 'gp1' and 's'

 

 

 

 

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.