0

Hi there,

wanna ask if the sql syntax order by and group by the same?
eg: i have a dropdownlist and the values displayed should be in ascending order. hence is there any difference if i use these 2 sql statements below.

sql1 = "select distinct * from t_staff group by staff"
sql2 = "select distinct * from t_staff order by staff"

i've tested it out and it works well. was curious to know if there is any explaination/meaning behind the scene.

Though i know it may be peanut to you guys..but Thanks Alot!

3
Contributors
7
Replies
8
Views
12 Years
Discussion Span
Last Post by ohgosh
0

oops :x sorry i think i post this thread to the wrong forum..

see ya guys in the forum under databases. hope to hear from you soon.

0

Hi,
Ya there is difference in order by and group by
When u fire group by query its aggregate similar entries and show u single entriy for tht
but in order by u order list in alphabeticaly order

0

Hi,
Ya there is difference in order by and group by
When u fire group by query its aggregate similar entries and show u single entriy for tht
but in order by u order list in alphabeticaly order

wad u mean by aggregrate similar entries? do u mean pick up oli distinct records? do it mean different if i remove distinct from select statement?

but i can still display my dropdownlist value in alphabeticaly order if i use group by..

is there anywhere to order the list in alphabeticaly order besides using order by?

0

huh wad do u mean? i try using order by, but error occured on the page. i dont understand wad happen so i had to use another method to resolve.

0

didn't i paste my sql statemt during my very 1st post?

sql1 = "select distinct * from t_staff group by staff"
sql2 = "select distinct * from t_staff order by staff"

btw ive used group by and it works well so i stil remain using group by.. :surprised

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.