troubleshooting Question

adding case statment with SELECT

Avatar of anderdw2
anderdw2Flag for United States of America asked on
7 Comments1 Solution1106 ViewsLast Modified:
I had asked how to get the LEFT JOIN to work with the following statement and got a great response.  However, now I'm stuck on another issue.    s.class and s.nir are numeric identifiers that do not have an associated table as a reference.   Can I add a case statement within the select to show their textual value?

Close Data

SELECT   s.batch, s.code, s.class as Package_Type, s.nir as NIR_type, s.account, s.arrival, s.return, as Feed_Type, s.describe, s.due, b.item as Special_Item, b.amount as Special_Amt, ;
             s.farmname, c.first, c.last,,, c.pricetier, s.postage, c.billto, c.address1,, c.state,, ;
   FROM samples s ;
  INNER JOIN samplexp x ON s.sampleid = x.sampleid ;
  INNER JOIN clients c ON s.account = c.account ;
  INNER JOIN feedcode f ON s.feed_type = f.feed_type ;
  LEFT JOIN billitem b ON s.sampleid = b.sampleid ;
  WHERE s.batch = 11748 ;
    AND x.location="LANCSAMPLE"
COPY TO C:\lancasterTest\lancBill TYPE DELIMITED

Cyril Joudieh
Founder, Software Engineer, Data Scientist

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros