mysql - i want to select and display two coluomns ,i.e itemcode and transdate in the subquery -


select itemcode,description,location,stocklevel,wtavg_cost,dddvalue          hms_pha_stock c      c.stocklevel>0      , itemcode not in      (         select itemcode          hms_pha_tranheader a, hms_pha_transaction b          a.refno = b.refno          , a.trantype = b.trantype          , a.trantype in ('pto','pis')          , b.location ='cph' , a.transdate between '2016-11-01' , '2016-11-08'      )      , c.location ='cph'      group itemcode 

you have used subquery in where clause. there can select 1 column satisfy clause condition.

below have modified query according requirement

select c.itemcode,         description,         location,         stocklevel,         wtavg_cost,         dddvalue    hms_pha_stock c  left join (select itemcode, transdate              hms_pha_tranheader a,                    hms_pha_transaction b              a.refno = b.refno                    , a.trantype = b.trantype                    , a.trantype in ( 'pto', 'pis' )                    , b.location = 'cph'                    , a.transdate between                        '2016-11-01' , '2016-11-08') ljoin on c.itemcode = ljoin.itemcode  c.stocklevel > 0         , ljoin.itemcode null         , c.location = 'cph'  group  c.itemcode  

hope should solve problem


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

Laravel mail error `Swift_TransportException in StreamBuffer.php line 269: Connection could not be established with host smtp.gmail.com [ #0]` -

C#.NET Oracle.ManagedDataAccess ConfigSchema.xsd -