Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calcualted value within SQL query

Status
Not open for further replies.

zsyed

MIS
Dec 25, 2011
73
CA
I've below SQL join expression and would like to have one more additional calculted field involving two of the tables:

SALESORDERLINES left outer join salesorders on omlsalesorderid = ompsalesorderid Left Outer JOIN (select smlsalesorderid, smlsalesorderlineid, max(smlshipmentid) as shipid FROM shipmentlines group by smlsalesorderid, smlsalesorderlineid) as test on omlsalesorderid = smlsalesorderid and omlsalesorderlineid = smlsalesorderlineid Left Outer JOIN (select ralsalesorderid, ralsalesorderlineid, sum(ralextendedprice) as returnvalue FROM rmaclaimlines group by ralsalesorderid, ralsalesorderlineid) as test1 on omlsalesorderid = ralsalesorderid and omlsalesorderlineid = ralsalesorderlineid left outer join organizations on ompshiporganizationid = cmoorganizationid

calculated value would be:
(Salesorderlines.omlextendedpricebase - test1.returnvalue)
How and where can I add to this query?
Many Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top