Using query with variables in c# and mysql -
i need following set of statements executed , gives fatal error need query output of following query uses 2 variables
database mysql , language c# trying use in c# code using myreader=new mysqlcommand(this query ,connection object).executereader()
set @lastitem := 0, @lastvalue := 0; select concat ( date (t5.inventorydate) ,t5.skuoritem ) pk, t5.customerid, t5.entityid, t5.inventorydate, t5.skuoritem, t5.category, t5.inventory ( select '3' customerid, '90' entityid, t1.inventorydate inventorydate, t1.iditem skuoritem, t4.categoryinventary category, ifnull(t1.itemqty,0) sales, ifnull(t2.buyqty,0) stockmove, @lastvalue := if( @lastitem = t1.iditem, @lastvalue + ifnull(t2.buyqty,0) - ifnull(t1.itemqty,0), ifnull(t2.buyqty,0) - ifnull(t1.itemqty,0) ) inventory, @lastitem := t1.iditem ( select date(date) inventorydate, iditem, sum(quantity) itemqty subway.saleitem group iditem, date(date) ) t1 left outer join ( select date(date) inventorydate, iditem, sum(initialbuyquantity) buyqty subway.invoicestock group iditem, date(date) ) t2 on t1.inventorydate = t2.inventorydate , t1.iditem = t2.iditem inner join subway.item t3 on t1.iditem = t3.iditem left join subway.categoryinventary t4 on t3.idcategoryinventary = t4.idcategoryinventary order t1.iditem, t1.inventorydate ) t5
wrap these queries stored procedure
or udf
. call c#
code.
Comments
Post a Comment