If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Other > Different WHERE filter on different columns

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-06-10, 07:31
tosa tosa is offline
Registered User
 
Join Date: Feb 2010
Posts: 35
Different WHERE filter on different columns

Hi!

I'm doing a sales report and I was wondering if it's possible to put filters on different columns. I would like column 1 to be the customer name, column 2 sales for 2010, column 3 sales for 2009 and so on...

This is what I have so far, selecting customer and sum and grouping by customer for a certain time period:
SELECT Customer.CustName, SUM(SlsLine.Price) FROM PUB.SlsLine INNER JOIN PUB.SlsOrder ON SlsLine.OrderNum=SlsOrder.OrderNum INNER JOIN PUB.Customer ON SlsOrder.OrdCustNum=Customer.CustNum WHERE SlsLine.IntDlvDate BETWEEN TO_DATE ('01/01/2010') AND TO_DATE ('12/31/2010') GROUP BY Customer.CustName HAVING SUM(SlsLine.Price) > 10000

I'm using a Progress database.

Thanks for any replies!
Reply With Quote
  #2 (permalink)  
Old 08-06-10, 09:31
dav1mo dav1mo is offline
Registered User
 
Join Date: Dec 2007
Location: Richmond, VA
Posts: 782
Take a look at the case expression
Dave
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On