1

By using SQL Server 2000, I want to create a output data template as shown below using data's in table1 and table2

Output Data_Template

Unit1   | Sale_value_1  | Sale_value_2|
-------------------------------------------    
chart1  | 25             |12|
chart2  | 30             |0|
chart3  | 56             |0|
chart4  | 41             |98|

Table1

Date        |Unit1  |Sale_value_1|
------------------------------------    
2/11/2014   |chart1 |25|
2/11/2014   |chart2 |30|
2/11/2014   |chart3 |56|
2/11/2014   |chart4 |41|

Table2

Date        |Unit1  |Sale_value_2|
-----------------------------------    
2/11/2014   |chart1 |12|
2/11/2014   |chart2 |0|
2/11/2014   |chart3 |0|
2/11/2014   |chart4 |98|
1
  • 2
    As a side note, your "technical term" of output data template does not make any sense in the vernacular. I believe it would be clearer if you had said I want to create an output result set or output table. Commented Feb 11, 2014 at 15:16

1 Answer 1

1

This SQL Fiddle demonstrates the below query:

SELECT t1.Unit1, t1.Sale_value_1, t2.Sale_value_2 
FROM Table1 as t1
INNER JOIN Table2 as t2 ON t1.Unit1 = t2.Unit1
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.