1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Mysql Query for CASE, WHERE, IF issues

Discussion in 'Software Development' started by noveltech, Jan 20, 2013.

Thread Status:
Not open for further replies.
  1. noveltech

    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,  
    
    
     
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 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1086153

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice