Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

where clause not working

I have a where clause that I am trying not to include FacID in my extract but it is not working and gives me no error?

LOAD *;

SQL SELECT  FacID,
PatID,
RxBatch,
DispenseDt,
RxNo,
NDC,
DrugLabelName,
MOP,
PriceCd,
InvoiceGrp,
IVType,
LastModifiedBy,
LastModifiedOn,
MOP2,
TtlPrice,
TransType,
DelivID,
DelivDate,
Entered,
PharmID

FROM Rx.dbo.Rxs

  Where FacID <> 'FORMS''MSTR''SAMPLE''TEST''TEST#2''TEST2''TEST3''TRLK''stag';

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Please try the following:

Where FacID <> 'FORMS'

        and FacID <> 'MSTR'

       and FacID <> 'SAMPLE'

       and FacID <> 'TEST'

       and FacID <> 'TEST#2'

       and FacID <> 'TEST2'

       and FacID <> 'TEST3'

       and FacID <> 'TRLK'

       and FacID <> 'stag'

View solution in original post

4 Replies
Anonymous
Not applicable
Author

Please try the following:

Where FacID <> 'FORMS'

        and FacID <> 'MSTR'

       and FacID <> 'SAMPLE'

       and FacID <> 'TEST'

       and FacID <> 'TEST#2'

       and FacID <> 'TEST2'

       and FacID <> 'TEST3'

       and FacID <> 'TRLK'

       and FacID <> 'stag'

Not applicable
Author

I just don't understand why sometims it works and other times it don't     But thank you!

sinanozdemir
Specialist III
Specialist III

I know this has been answered, but you can also use the below option:

  • Where Not Match(FactID, 'FORMS', 'MSTR', 'SAMPLE', 'TEST', 'TEST#2', 'TEST3', 'TRLK', 'stag');

Thanks

Not applicable
Author

thank you will put that in my notes