Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

making 3 recordsets into one

Status
Not open for further replies.

dpk136

MIS
Jan 15, 2004
335
US
I am doing a projected stock status report and have 3 recordsets that need to be looked at for this. I already have the sql statements i need to make the individual recordsets work but i need to be able to make one recordset so that i can make it into a report sorted by date and part number. Below are what the recordsets produce individually. Is there anyway to put these into one recordset so that it can be sorted.

In Transit
Type | PartNum | RepDate | TotalQty
I | 1548S15 | 2/21/07 | 50000
I | 3827193 | 3/2/07 | 137890

Purchase Orders
Type | PartNum | RepDate | TotalQty
P | 7261456 | 1/30/07 | 2872
P | 2827374 | 2/27/07 | 28271
P | 4723263 | 3/1/07 | 100000

Sales
Type | PartNum | RepDate | TotalQty
S | 7261456 | 3/2/07 | 1000
S | 2837261 | 3/28/07 | 28372

I need it to be in one recordset that looks like
Type | PartNum | RepDate | TotalQty
P | 7261456 | 1/30/07 | 2872
I | 1548S15 | 2/21/07 | 50000
P | 2827374 | 2/27/07 | 28271
P | 4723263 | 3/1/07 | 100000
I | 3827193 | 3/2/07 | 137890
S | 7261456 | 3/2/07 | 1000
S | 2837261 | 3/28/07 | 28372

David Kuhn
------------------
 
You can do this at the database level by using the UNION ALL operator.

Ex.

[tt][blue]
Select Type, PartNum, RepDate, TotalQty
From Table1

Union All

Select Type, PartNum, RepDate, TotalQty
From Table1

Union All

Select Type, PartNum, RepDate, TotalQty
From Table1

Order BY RepDate, PartNum
[/blue][/tt]

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top