G
Guest
Hi (original query posted 4/22/2004 2.33PM
I have tried to create the union query as per your last post. I'm not having any joy at the minute (i'm positive its something that im doing!) as i keep getting a syntax in FROM clause. I'm sure i followed your instructions to the letter but i'm still doing something wrong
Below is what i have written.
SELECT TOP 10 productcode, Count(1
FROM
(UNION SELECT column7 AS productcode FROM Garment Tracking Details
UNION SELECT column8 FROM Garment Tracking Details
UNION SELECT column9 FROM Garment Tracking Details
UNION SELECT column10 FROM Garment Tracking Details
GROUP BY productcod
ORDER BY Count(1) DESC
The way my table is set out is as follows:- ( i know the table is not normalised, i inherited it!, i will eventually change it) I would put the results of Prod 1-Prod 8 in one column. I would also like to put in a date paremeter if poss
GMTNo Date Brand StoreNo Storetelno Storecontact Prod 1 Prod 2 Prod 3 Prod 4 Prod 5 Prod 6 Prod 7 Prod
eg 1 12/5/04 Cst 9985 Julie 211116089014 785890458616 etc etc
I would be grateful for any help you can offer
Thanks as alway
Caro
I have tried to create the union query as per your last post. I'm not having any joy at the minute (i'm positive its something that im doing!) as i keep getting a syntax in FROM clause. I'm sure i followed your instructions to the letter but i'm still doing something wrong
Below is what i have written.
SELECT TOP 10 productcode, Count(1
FROM
(UNION SELECT column7 AS productcode FROM Garment Tracking Details
UNION SELECT column8 FROM Garment Tracking Details
UNION SELECT column9 FROM Garment Tracking Details
UNION SELECT column10 FROM Garment Tracking Details
GROUP BY productcod
ORDER BY Count(1) DESC
The way my table is set out is as follows:- ( i know the table is not normalised, i inherited it!, i will eventually change it) I would put the results of Prod 1-Prod 8 in one column. I would also like to put in a date paremeter if poss
GMTNo Date Brand StoreNo Storetelno Storecontact Prod 1 Prod 2 Prod 3 Prod 4 Prod 5 Prod 6 Prod 7 Prod
eg 1 12/5/04 Cst 9985 Julie 211116089014 785890458616 etc etc
I would be grateful for any help you can offer
Thanks as alway
Caro