Product Name CustomerName
------------ ------------
KeyboardKBX Cust1
KeyboardKBX Cust1
KeyboardXLS Cust2
KeyboardXLS Cust2
Never try to be a hard-worker. Be a smart-worker.
My Blog
Originally posted by Muhammad Saifuddin:
Never try to be a hard-worker. Be a smart-worker.
My Blog
Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Originally posted by Shailesh Chandra:
try making a query like below
Select ProductName, CustomerName, Count(CustomerName) from table_name group by ProductName,CustomerName
Thanks,
Shailesh
Never try to be a hard-worker. Be a smart-worker.
My Blog
Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
OCUP UML fundamental and ITIL foundation
Originally posted by Jan Cumps:
This is the logic you can follow:
select the rows where you want to create the count for,
use the group by clause to combine identical values
use count(*) to count the number of combine records
[ August 27, 2008: Message edited by: Jan Cumps ]
Never try to be a hard-worker. Be a smart-worker.
My Blog
Originally posted by Rajkumar balakrishnan:
How could i get the count coloumn in JSP... may i use like this..
rs.getString("count");???
Is this rite?
[ August 28, 2008: Message edited by: Rajkumar balakrishnan ]
Regards, Rene Larsen
Originally posted by Rene Larsen:
If you add e.g. "as Number" to the count(*), then you can get it by rs.getInt("Number")
+----------------------------+-------------+----------+-----------+
| item_description | customer_id | count(*) | serial_no |
+----------------------------+-------------+----------+-----------+
| FARASOO KEYBOARD KBX78 | CI001 | 2 | MO77,MO56 |
|----------------------------+-------------+----------+-----------+
Never try to be a hard-worker. Be a smart-worker.
My Blog
I don't think standard SQL supports this requirement.But at the same time if the count is 2 means i need those two products serial number like this..
OCUP UML fundamental and ITIL foundation
You asked about counting identical items, and you have now told us the items are no longer identical . . .Originally posted by Jan Cumps:
I don't think standard SQL supports this requirement.
Originally posted by Campbell Ritchie:
You asked about counting identical items, and you have now told us the items are no longer identical . . .
Never try to be a hard-worker. Be a smart-worker.
My Blog
Don't get me started about those stupid light bulbs. |