View Full Version : sort record according to specifc condition

02-19-2008, 06:33 PM

i selected all data from mysql database, however i want to do some special functions like sort according to customer name ( all records with same customer group together) etc

how can i do that? i have checked use of group by, but it is not right, it only shows one record of each customer, not all records of the same customer, anyone helps? is it possible to write in one query?

Andrew Johnson
02-19-2008, 06:38 PM
Try something like:

SELECT * FROM tblCustomers ORDER BY CustomerID

Or with a WHERE clause:

SELECT * FROM tblCustomers WHERE CustomerName='Bob' ORDER BY CustomerID