Home > database > How to sort by two fields, SQL EXCLE can ah. The following
How to sort by two fields, SQL EXCLE can ah. The following
Time:11-09
Want to sort by XL sales and sup_nam suppliers, Is this table sorting effect Statement is The select item_no, item_name, xl, item_clsname sup_name from temp_mxp_topxx k group by sup_name, item_no, item_name, XL, item_clsname having item_no in (select top 30 m.i tem_no from temp_mxp_topxx m where Keith up_name=Margaret spellings up_name The order by XL desc ) order by XL, sup_name Effect is Not line, The great spirit of SQL, maybe EXCLE could overshadow SQL? !
CodePudding user response:
The select item_no, item_name, xl, item_clsname sup_name from temp_mxp_topxx k group by sup_name, item_no, item_name, XL, item_clsname having item_no order by XL, sup_name So try
CodePudding user response:
Don't understand what you mean, Your SQL, the order by XL, sup_name Sort by XL, and then press sup_name sorting,
XL is there so much 12, of course, have to row together ah, Queue up to turn sup_name,
If you want to sup_name priority, it should be: the order by sup_name, XL
CodePudding user response:
Thank you upstairs to pay tribute, although an error, I again churning churning replaced under the back of the two fields is a step in the right order, although I don't know is why,,, The select item_no, item_name, xl, item_clsname sup_name from temp_mxp_topxx k group by sup_name, item_no, item_name, XL, item_clsname having item_no in (select top 30 m.i tem_no from temp_mxp_topxx m where Keith up_name=Margaret spellings up_name The order by XL desc ) order by sup_name, XL