CariDotMy

 Forgot password?
 Register

ADVERTISEMENT

View: 1991|Reply: 5

mySql query to sort the value in a column

[Copy link]
Post time 29-6-2007 08:53 AM | Show all posts |Read mode
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

Use magic Report


ADVERTISEMENT


Post time 29-6-2007 11:30 AM | Show all posts

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.....
Reply

Use magic Report

Post time 29-6-2007 02:44 PM | Show all posts
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
Reply

Use magic Report

 Author| Post time 1-7-2007 12:41 AM | Show all posts
Thanks! It helps!
Reply

Use magic Report

Post time 5-7-2007 04:41 PM | Show all posts
Off-topic....ini error mysql yg aku dapat masa loading page forum.cari...hehehe

Reply

Use magic Report

Post time 5-7-2007 04:52 PM | Show all posts

Reply #5 ultra78's post

kenapa pergi highlight password tu...
Reply

Use magic Report

Follow Us
You have to log in before you can reply Login | Register

Points Rules

 

ADVERTISEMENT



 

ADVERTISEMENT


 


ADVERTISEMENT
Follow Us

ADVERTISEMENT


Mobile|Archiver|Mobile*default|About Us|CariDotMy

3-1-2025 03:25 AM GMT+8 , Processed in 0.334836 second(s), 19 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

Quick Reply To Top Return to the list