dimanche 21 décembre 2014

How to create Sqlite Create View with multiple tables involved

Please help me create view on sqlite database using sample table content below


Customer


Customer_ID | Name | Customer_No


1 | Jen | CU77


2 | Adam | CU12


Sales_Order


Sales_Order_ID | Customer_ID | Date


1 | 2 | jan 2


2 | 1 | jan 3


3 | 2 | jan 4


Orders


Orders_ID | Product_ID | Sales_Order_ID | Quantity


1 | 1 | 1 | 4


2 | 2 | 1 | 1


3 | 3 | 2 | 3


Product


Product_ID | Product_name | Price


1 | Coke | 2


2 | Biscuits | 1


3 | Candy | 1.5


I want to appear in view like this:


Date | Customer Name | Product Name | Quantity | Price | Total Cost


Jan 2 | Adam | Coke | 4 | 2 | 8


Jan 2 | Adam | Biscuits | 1 | 1 | 1


Jan 3 | Jen | Candy | 3 | 1.5 | 4.5


Jan 4 | Adam | Coke | 2 | 2 | 4


//not related, im using c# anyway. thanks in advance to those can help. Merry Christmas!


Aucun commentaire:

Enregistrer un commentaire