Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 And Or Operator

Author  Topic 

ozandalkiran
Starting Member

13 Posts

Posted - 2014-04-10 : 05:09:02
Hi
i wanna write many and or operator.
but when i wrote below code date interval nor working
may u help me pls

convert(varchar(10),[CreateDate],104) as CreateDate
,[StatusCode]
,[MainCompanyLicenseCode]
,SST.SpecialStatusTypeName
,SS.Description
,[EPDKLicenseCode]
,[StationID]
,[DealerID]
,[EPDKProductNameID]
,[EPDKProductName]
,[ProductID]
,[StartDateTime]
,[EndDateTime]
,[SpecialStatusTypeID]
,[Missing]
,[Gain]
,[Status]
,[Approve]
,[IsSent]
,[StatusInfo]
,[CreatedBy]
,[CreationTime]
,[UpdatedBy]
,[UpdatedTime]
,[UpdateSource]
,[UpdatedByID]
,[IsManuel]
,[Missing_Bk]
,[Gain_Bk]
,[EPDKDescriptionID]
,[EpdkTableNumber]
,[EpdkSpecialStatusResponsiblesID]
,[Flag]
FROM [PUMPOMAT_HO].[dbo].[EPDK_Table08_SpecialStatus] SS
inner join EPDK_SpecialStatusTypes SST
on
SS.SpecialStatusTypeID = SST.RID
where
CreateDate between '20140101' and '20140409' and
EpdkTableNumber =1 and SS.Description like '%1%tank%' or SS.Description like '%2%tank%' or
SS.Description like '%3%tank%' or SS.Description like '%4%tank%' or
SS.Description like '%5%tank%' or SS.Description like '%6%tank%'

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2014-04-10 : 05:41:58
[code]where CreateDate between '20140101' and '20140409'
and (
EpdkTableNumber =1 and SS.Description like '%1%tank%'
or SS.Description like '%2%tank%'
or SS.Description like '%3%tank%'
or SS.Description like '%4%tank%'
or SS.Description like '%5%tank%'
or SS.Description like '%6%tank%'
)[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2014-04-10 : 06:44:17
or simply

where
CreateDate between '20140101' and '20140409' and
EpdkTableNumber =1 and SS.Description like '%[123456]%tank%'


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

ozandalkiran
Starting Member

13 Posts

Posted - 2014-04-10 : 07:02:39
thank you

quote:
Originally posted by madhivanan

or simply

where
CreateDate between '20140101' and '20140409' and
EpdkTableNumber =1 and SS.Description like '%[123456]%tank%'


Madhivanan

Failing to plan is Planning to fail

Go to Top of Page
   

- Advertisement -