| Author |
Topic  |
|
|
Yonkouturko
Starting Member
Philippines
36 Posts |
Posted - 01/05/2013 : 08:41:27
|
SELECT Qty, Category, Description, Tpc_Price, Srp, Visibility, Low, Average, High FROM Table_TPC_POSTING ORDER BY Category UNION SELECT Qty, Category, Description, Tpc_Price, Srp, Visibility, Low, Average, High FROM Table_TPC_POSTING ORDER BY Description
im getting error like this " Column 'Table_TPC_POSTING.Qty' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. "
i really don't understand right now sql Errors.. because im still new at this... PLEASE HELP ME...
|
|
|
jimf
Flowing Fount of Yak Knowledge
USA
2868 Posts |
Posted - 01/05/2013 : 16:14:44
|
Just get rid of the first order by
SELECT Qty, Category, Description, Tpc_Price, Srp, Visibility, Low, Average, High FROM Table_TPC_POSTING
ORDER BY Category UNION SELECT Qty, Category, Description, Tpc_Price, Srp, Visibility, Low, Average, High FROM Table_TPC_POSTING ORDER BY Description
Post your full query if this doesn't solve the issue.
Jim
Everyday I learn something that somebody else already knew |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47157 Posts |
Posted - 01/06/2013 : 10:32:01
|
hmm? whats the purpose of above two queries? they look same to me
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
|
Yonkouturko
Starting Member
Philippines
36 Posts |
Posted - 01/06/2013 : 20:57:47
|
ahhh here are some of the data of Column CATEGORY and DESCRIPTION
Category Description HARDDISK HardDisk 80GB IDE Desktop Seagate SP MONITOR 15"LCD SP ASSORTED MONITOR 17"LCD surplus ASSORTED MONITOR 17"LCD surplus (Black) MONITOR 17"LCD SAMSUNG SYNCMASTER SP MONITOR 19"LCD SP ASSORTED MONITOR 22"LCD SP ASSORTED HARDDISK HardDisk 250 GB IDE SP Desktop Seagate HARDDISK HardDisk 250 GB SATA BN Desktop Seagate HARDDISK HardDisk 500 GB SATA Desktop (SURPLUS) CASING PISONET CASING ONLY w/ out accessories CASING PISONET CASING with accessories VIDEO CARD VIDEO CARD 1 GB MANLI GEFORCE210 DDR3 64BIT PCI-E CABLE UTP CABLE GRAY (Brand New) MOTHERBOARD MOTHERBAORD (FOR AMD) MOBO AM2 w/ build-in VIDEO SP HARDDISK HardDisk 40 GB IDE SP Desktop Seagate CASING HIP MINI w/ PSU HFI-5R MEMORY Memory 4 GB DDR3 SODIMM 1333 BN Kingston MONITOR 15"LCD SURPLUS (Black) MONITOR 15.6"LED AOC (Brand new) MONITOR 19"LCD SP ASSORTED2 MONITOR 22"LCD SP ASSORTED1 MONITOR 22"LCD SP ASSORTED2 CASING CASING HIP MINI w/out PSU HFI-5R BN MONITOR 17"LCD wide surplus MONITOR 19"LCD SP ASSORTED3 MONITOR 19"LCD SP ASSORTED1 MONITOR 19"LCD SP ASSORTED4 HARDDISK HardDisk 80GB sata Desktop Seagate SP HARDDISK HardDisk 320 GB SATA SP Desktop Seagate
NOW IF POSSIBLE... I WANT TO ALPHABETIZE EACH COLUMN.. THATS WHY i order each COLUMN and UNION them.....
PLease HELP ME OUT!!!
THANK YOU!!!!
|
 |
|
|
Yonkouturko
Starting Member
Philippines
36 Posts |
Posted - 01/07/2013 : 00:23:02
|
@VISAKH i've figured Out my problem... but still thanks for your support!!! i really appreciate all the learning !! :D
here's my sql
SELECT Qty, Category, Description, Tpc_Price, Srp, Visibility, Low, Average, High FROM Table_TPC_POSTING ORDER BY Category, Description
i really thought that i cudn't ORDER BY 2 fields at the same time... silly me.. hahaha |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47157 Posts |
Posted - 01/07/2013 : 10:13:02
|
ok...now it makes sense 
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
| |
Topic  |
|
|
|