RE: query help

2012-09-13 Thread Rick James
Transposing is ugly in SQL. It is better done in some other language (PHP, Java, ...) If you must do it in SQL, search for pivot Peter Brawley > -Original Message- > From: Stillman, Benjamin [mailto:bstill...@limitedbrands.com] > Sent: Thursday, September 13, 2012 7:09 AM > To: 'Ric

RE: query help

2012-09-13 Thread Stillman, Benjamin
I think this will get you there: SELECT LEAD, COUNT(*) FROM ORDERS GROUP BY LEAD; It'll give you something more like: | LEAD | COUNT(*) | | F | 44 | | S | 122 | | R | 32 | -Original Message- From: Richard Reina [mai

query help

2012-09-13 Thread Richard Reina
I have a table like this: |ORDERS| |ID| DATE | QNT | LEAD | |342 | 8-12-12 | 32 | F| |345 | 8-15-12 | 12 | S| |349 | 8-16-12 | 9 | R| I am looking for a way to query it with counts by the LEAD column in order to tell what the number of each type lead is,