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
https://forums.phpfreaks.com/topic/91778-confusing-multiple-where-statement/
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.