|
|
Question : Multiple Like Statements -- more effiicient?
|
|
I have this query with the conditions of username like %. I wondered if there is an easier way to do this without having to break into two separate blocks. Also, is there a more efficient way to get the Dates that I'm using?
where username like 'gp0%' and r.key3 <>0 --and detail = 'INVOCATION_BEGIN' and type in ('FD_Command','FD_SAVE','FD_SKIP') and (ra.action_time between (CAST(convert(varchar(10),getdate(),120)+' 12:00:00' as datetime)-1) and (CAST(convert(varchar(10),getdate(),120)+' 12:00:00' as datetime)-0))
or username like 'ybrant0%' and r.key3 <>0 --and detail = 'INVOCATION_BEGIN' and type in ('FD_Command','FD_SAVE','FD_SKIP') and (ra.action_time between (CAST(convert(varchar(10),getdate(),120)+' 12:00:00' as datetime)-1) and (CAST(convert(varchar(10),getdate(),120)+' 12:00:00' as datetime)-0))
|
Answer : Multiple Like Statements -- more effiicient?
|
|
where (username like 'gp0%' or username like 'ybrant0%' ) and r.key3 <>0 --and detail = 'INVOCATION_BEGIN' and type in ('FD_Command','FD_SAVE','FD_SKIP') and (ra.action_time between (CAST(convert(varchar(10),getdate(),120)+' 12:00:00' as datetime)-1) and (CAST(convert(varchar(10),getdate(),120)+' 12:00:00' as datetime)-0))
|
|
|
|
|