chokka
asked on
SQL Query Tuning
SQL Query Tuning
1) In the below query, I am trying to fetch Status only - 'A' or 'P'. But i am getting output with all the status available in the Table.
2) I have mentioned RxProName <> ICName. But still i am getting the Matching Values of both the columns.
1) In the below query, I am trying to fetch Status only - 'A' or 'P'. But i am getting output with all the status available in the Table.
2) I have mentioned RxProName <> ICName. But still i am getting the Matching Values of both the columns.
select Member,Status,DOB,RxProName,ICName from dbo.VW_RxsToPrint
where ICName like '%SC Med%'
or ICName like '%NC Med%'
and RTRIM(RxProName) <> RTRIM(ICName)
and VW_RxsToPrint.Status in ('A','P')
order by VW_RxsToPrint.Status ASC
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you lwadwell
select Member,Status,DOB,RxProNam e,ICName from dbo.VW_RxsToPrint
where ( ICName like '%SC Med%'
or ICName like '%NC Med%' )
and RTRIM(RxProName) <> RTRIM(ICName)
and VW_RxsToPrint.Status in ('A','P')
Returns exact results
select Member,Status,DOB,RxProNam
where ( ICName like '%SC Med%'
or ICName like '%NC Med%' )
and RTRIM(RxProName) <> RTRIM(ICName)
and VW_RxsToPrint.Status in ('A','P')
Returns exact results
ASKER