I could really use some assistance re configuring the query below.
I am trying to bring back data for the "Invtid" which will show the last "Invcdate" and the "ShipperID" which in was invoiced on
select i.invtid, i.Descr,
(select top (1) b.InvcDate--,a.ShipperID
from SOShipLine a, SOShipHeader b
and b.SOTypeID in ('CS','SO')
order by a.ShipperID desc)
from inventory i
order by i.invtid
I have commented out the --,a.ShipperID for the purposes of getting the query to run with just the Invcdate getting return but I could really use the ShipperId.
When I don't comment it out I get the following error:"Msg 116, Level 16, State 1, Line 8
Only one expression can be specified in the select list when the subquery is not introduced with EXISTS."
your assistance will be greatly appreicated.