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!

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.

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

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?

Why u not using orderby its not have any distadvantage

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.

paste your sql statement

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.