dbTalk Databases Forums  

Help with SQL statement?

comp.database.ms-access comp.database.ms-access


Discuss Help with SQL statement? in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Martin
 
Posts: n/a

Default 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?

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.