• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 105
  • Last Modified:

Query that Concatenates Data from Two Tables

Thank you for looking at my question,

I have two tables SO_Header_Live and SO_Header_Posted.

SO_Header_Live
SO_Number,
SO_Date,
Customer,
SO_CostTotal,
SO_SalesValueTotal

SO_Header_Posted
SO_Number,
SO_Date,
Customer,
SO_CostTotal,
SO_SalesValueTotal


I need a single query that returns the SO_Number and SO_SalesValueTotal from both tables between two dates.

Any help you can provide would be greatly appreciated.
0
Gary Croxford
Asked:
Gary Croxford
1 Solution
 
Brian CroweDatabase AdministratorCommented:
DECLARE @StartDate   DATETIME,
   @EndDate   DATETIME;

SELECT SO_Number, SO_SalesValueTotal
FROM SO_Header_Live AS L
WHERE SO_Date >= @StartDate
   AND SO_Date <= @EndDate

UNION

SELECT SO_Number, SO_SalesValueTotal
FROM SO_Header_Posted
WHERE SO_Date >= @StartDate
   AND SO_Date <= @EndDate
0
 
Gary CroxfordOperations Support AnalystAuthor Commented:
Thank you
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now