Help with SQL statement? -
11-30-2009
, 10:10 AM
I have a database that contains these fields (among others):
OrderNum Barcode
ABC123 121212
G123 123456
ABC123 232323
G123 654321
XYZ888 876543
This SQL statement:
TRANSFORM First(Barcode) AS X
SELECT Barcode FROM Orders WHERE StationNum=3
GROUP BY Barcode PIVOT OrderNum;
Returns this data set (which contains empty "cells" that I don't
want):
------------------------------------
Barcode | ABC123 | G123 | XYZ999
121212 | 121212 | |
123456 | | 123456 |
232323 | 232323 | |
565656 | | | 565656
------------------------------------
What SQL statement can I use to return this data set:
------------------------
ABC123 | G123 | XYZ999
121212 | 123456 |
232323 | | 565656
------------------------
I want to have a column for each order containing the barcodes for
that order.
Help? |