Mysql Query for CASE, WHERE, IF issues

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

noveltech

Thread Starter
Joined
Sep 29, 2002
Messages
73
In need of help to do the following calc in mysql query. Trying to get a new calc col in results of query.

col for counties (Lu_Zip.County), col for parts cost (tbl_Invoices.PartsCost), col for Total Amt (tbl_Invoices.Total_Amt).

I need to get the numbers from col: Total Amt if the county = cty1 or cty2 or cty3 AND IF parts cost is greater then .01 OR I need to get the numbers from col: Total Amt if the county = cty4 regardless of parts cost.

My code below does not work and I have been working on it for several days. Hoping for an answer within the forum. Thanks, All feedback welcomed.

Code:
(CASE WHEN tbl_Invoices.PartsCost < 0.01 AND Lu_Zip.County = 'Cty1' OR 'Cty2' OR 'Cty3') OR WHERE Lu_Zip.County = 'Cty4' AND tbl_Invoices.PartsCost <> 0

THEN tbl_Invoices.Total_Amt END) AS EXEMPT_SALES,
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top