Skip to Content
0
Mar 09, 2010 at 09:01 AM

i need query help

25 Views

Hello sap experts

pls help me in solving this query and my query follows

1). SELECT U_EnvDocDt,U_EnvVsNm[Tug/Boat],

Convert(varchar(11),U_EnvOfHDt,106)[OFF Hire Date],U_EnvOfHTm[OFF Hire Time],

Convert(varchar(11),U_EnvOHDt,106)[ON Hire Date],U_EnvOHTm[ON Hire Time] FROM [@Env_FLOTLA_USAGE]

WHERE DocEntry not in (select DocEntry FROM [@Env_FLOTLA_USAGE]

WHERE U_EnvVsNm ='Baytur'and U_EnvDocDt>='01/12/09'and U_EnvDocDt<='31/12/09' And

U_EnvOfHDt is null and U_EnvOHDt is null) and

U_EnvVsNm ='Baytur'and U_EnvDocDt>='01/12/09'and U_EnvDocDt<='31/12/09' and

U_EnvOfHDt is not null and U_EnvOHDt is null

2). SELECT U_EnvDocDt,U_EnvVsNm[Tug/Boat],

Convert(varchar(11),U_EnvOfHDt,106)[Off Hire Date],U_EnvOfHTm[OFF Hire Time],

Convert(varchar(11),U_EnvOHDt,106)[On Hire Date],U_EnvOHTm[On Hire Time] FROM [@Env_FLOTLA_USAGE]

WHERE DocEntry not in (select DocEntry FROM [@Env_FLOTLA_USAGE]

WHERE U_EnvVsNm ='Baytur'and U_EnvDocDt>='01/12/09'and U_EnvDocDt<='31/12/09' And

U_EnvOfHDt is null and U_EnvOHDt is null) and

U_EnvVsNm ='Baytur'and U_EnvDocDt>='01/12/09'and U_EnvDocDt<='31/12/09' and

U_EnvOfHDt is null

output for first and second query

1) 2009-12-19 00:00:00.000 Baytur 19 Dec 2009 1212 NULL NULL

2009-12-28 00:00:00.000 Baytur 28 Dec 2009 1212 NULL NULL

2).2009-12-20 00:00:00.000 Baytur NULL NULL 20 Dec 2009 1212

2009-12-30 00:00:00.000 Baytur NULL NULL 30 Dec 2009 1212

now my output should be

2009-12-19 00:00:00.000 Baytur 19 Dec 2009 1212 20 Dec 2009 1212

2009-12-28 00:00:00.000 Baytur 28 Dec 2009 1212 30 Dec 2009 1212

pls solve this and give as soon as possible

thanking u Jennifer