View: 1991|Reply: 5
|
mySql query to sort the value in a column
[Copy link]
|
|
Hello,
Does anyone here know how to sort the table displayed using query statement by its column, say price. Let say the table contains no, name and price. I wanted to display the table with all the rows with the same price together. If the price are different another table is displayed.
Urgent and desperate to look for the solutions. I have used group by but it only display one row of data. |
|
|
|
|
|
|
|
Reply #1 Asiafever's post
just add "order by price"
tp nengok soklan tue mcm ko nak view certain price so ape guna nak sort price yg sama :hmm:
utk soklan psl display one row of data tu rasanye psl tak de statement while()
itu jer..... |
|
|
|
|
|
|
|
I don't think there is any sql statement can do that. But you can try to use sql statement in nested loop..
eg.
1. Search all the existing price
2. Search all field using each of the price and display it.
err.. I don't know how to explain,
SELECT DISTINCT price FROM table
while recordset read
put price in variable called price
SELECT * FROM table WHERE Price = price
view in table (do something here so everytime it display, it display in new table)
end while
sorry, I don't know how to explain this but hope u can get rough idea |
|
|
|
|
|
|
|
Off-topic....ini error mysql yg aku dapat masa loading page forum.cari...hehehe
|
|
|
|
|
|
|
|
Reply #5 ultra78's post
kenapa pergi highlight password tu... |
|
|
|
|
|
|
| |
|