-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: microdotnet
Message 1 in Discussion
Hi, I am facing a strange problem... I have a query given below... when I am
trying to define a global variable mode with value as '1' and try to access in query
using '?' . I am not able to use this in a query before union but able to use it in
after union statement. Any reason why ? Any help will be appreciated.. Thanks
Sagar SELECT
OH.ORDNUM AS HSBA,
N1.COSTCT AS HFCC,
N1.FLSSTE AS HFSITE,
N2.COSTCT AS HTCC,
N2.FLSSTE AS HTSITE,
' ' AS HETA,
' ' AS HETAID,
max(OD.DELMTD) AS HMODE,
OH.EVTNUM AS HFROM,
upper(replace(stuff(replace(convert(char(20) ,OH.ENTDTE, 113), ':', ''),12,1,':'),'
','') ) AS HODAT,
CASE
WHEN (SELECT ISNULL(SUM(IDL.SHPQTY),0) FROM INVHDR IH, INVDTL IDL
WHERE IH.SHIPID = IDL.SHIPID AND IH.ORDNUM = OH.ORDNUM) = 0 THEN 0
ELSE 1
END as HSTAT,
' ' AS HSHIPF
FROM ORDHDR OH, ORDDTL OD, NODMST N1, NODMST N2
WHERE OH.ORDNUM = OD.ORDNUM AND
OH.STCUST = N1.NODNUM AND
OD.SUPNOD = N2.NODNUM and ('1' = ? or ('0' = ? and N1.SYSTYP = 'SLS' and N2.SYSTYP =
'SLS'))
GROUP BY OH.ORDNUM, N1.COSTCT, N1.FLSSTE, N2.COSTCT, N2.FLSSTE, OH.EVTNUM, OH.ENTDTE
UNION
SELECT --salesorder Non-FSL's
OH.ORDNUM AS HSBA,
' ' AS HFCC,
C.FINSTE AS HFSITE,
N1.COSTCT AS HTCC,
N1.FLSSTE AS HTSITE,
' ' AS HETA,
' ' AS HETAID,
max(OD.DELMTD) AS HMODE,
OH.EVTNUM AS HFROM,
upper(replace(stuff(replace(convert(char(20) ,OH.ENTDTE, 113), ':', ''),12,1,':'),'
','') ) AS HODAT,
CASE
WHEN (SELECT ISNULL(SUM(IDL.SHPQTY),0) FROM INVHDR IH, INVDTL IDL
WHERE IH.SHIPID = IDL.SHIPID AND IH.ORDNUM = OH.ORDNUM) = 0 THEN 0
ELSE 1
END as HSTAT,
' ' AS HSHIPF
FROM ORDHDR OH, ORDDTL OD, NODMST N1, CSTMST C
WHERE OH.ORDNUM = OD.ORDNUM AND
OH.STCUST = C.STCUST AND
OD.SUPNOD = N1.NODNUM and ('1' = ? or ('0' = ? and N1.SYSTYP = 'SLS'))
GROUP BY OH.ORDNUM, N1.COSTCT, N1.FLSSTE, C.FINSTE, OH.EVTNUM, OH.ENTDTE
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]