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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combine Several Select Statements in a SP

Status
Not open for further replies.

codrutza

Technical User
Mar 31, 2002
357
IE

I use SAP Crystal Reports and Microsoft SQL Server Management Studio.
I have a select1 which retrieve all the jobs, sales
I have another select2 which retrieve only the jobs which have invoices to customs; for taking the invoices to customs, I have to link other tables to the original link; I use a UNION because I have to link purchases invoices and sales invoices.
Select1:
[pre]
Job Sales
J1 100
J2 150
J3 250
J4 300
J5 200
[/pre]

Select2:
[pre]
Job Sales/Purchases Customs
J2 150 50
J3 250 80
[/pre]

I have to get the result
[pre]
Job Sales/Purchases Customs
J1 100
J2 150 50
J3 250 80
J4 300
J5 200
[/pre]
I have no idea how to write a script/stored procedure to accomplish this.
Can you help?

 
Hi,

What is the SQL for select1 and select2?

How is Sales different than Sales/purchases?

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top