c# - Complex Query design for access database -
i have following 3 tables (only showing required fields representation reasons).
table 'product_master'
id productname 1 jens 2 t-shirt 3 shirt 4 cap
table 'bill'
id invoiceno date 1 inv001 19/9/2013 2 inv002 20/9/2013 3 inv003 20/9/2013
table 'billdetails'
id invoiceno productid qyt 1 inv001 1 2 2 inv001 2 3 3 inv001 4 1 4 inv002 2 1 5 inv002 3 2 6 inv003 1 3 7 inv003 4 2
the output want
salesreport(daily between 2 date)
productname totalsales date jens 2 19/9/2013 t-shirt 4 19/9/2013 shirt 2 19/9/2013 cap 1 19/9/2013 jens 3 20/9/2013 t-shirt 0 20/9/2013 shirt 0 20/9/2013 cap 2 20/9/2013
this query didn't work:
select [pm.product_master], [sum(im.qyt)], [bm.date] [product_master] pm inner join [billdetails] im on [pm.sno] = [im.prod_sno] inner join [bill] bm on [im.invoiceno] = [bm.invoiceno]
now want output way salesreport(daily between 2 date)
in order compute total sales per day, have group
data date. specifying period, have use having
clause.
select product_master.productname, sum(billdetails.qty) sumofqty, bill.dated bill inner join ( product_master inner join billdetails on product_master.id = billdetails.productid ) on bill.invoiceno = billdetails.invoiceno group product_master.productname, bill.dated having bill.dated between #9/19/2013# , #9/20/2013# order bill.dated, product_master.productname
Comments
Post a Comment