List:General Discussion« Previous MessageNext Message »
From:Benjamin Stillman Date:September 13 2012 2:08pm
Subject:RE: query help
View as plain text  
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 [mailto:gatorreina@stripped]
Sent: Thursday, September 13, 2012 9:51 AM
To: mysql@stripped
Subject: query help

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, so that I get something like this:

F_LEADS  S_LEADS  R_LEADS
 44             122         32

Is this possible?  If so can anyone help with syntax?

Thanks,

Richard

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql


________________________________

Notice: This communication may contain privileged and/or confidential information. If you
are not the intended recipient, please notify the sender by email, and immediately delete
the message and any attachments without copying or disclosing them. LBI may, for any
reason, intercept, access, use, and disclose any information that is communicated by or
through, or which is stored on, its networks, applications, services, and devices.
Thread
query helpRichard Reina13 Sep
  • RE: query helpBenjamin Stillman13 Sep
    • RE: query helpRick James13 Sep