bfuchs
asked on
How can I exclude some wording in a like statement?
Hi Experts,
I would like to filter for something like "*Varicella*" in a varchar field type, but should not include "Varicella_lab", meaning this is not considered Varicella, however I still want see this record if it has the word Varicella.
I know adding not like "*Varicella_lab* would not work as it will not give me that record if both are there..so how can this be accomplished in a simple manner?
I would like to filter for something like "*Varicella*" in a varchar field type, but should not include "Varicella_lab", meaning this is not considered Varicella, however I still want see this record if it has the word Varicella.
I know adding not like "*Varicella_lab* would not work as it will not give me that record if both are there..so how can this be accomplished in a simple manner?
Bob, this is no PowerShell question ;-).
Hard to do with simple pattern matches and likes. Isn't there any delimiter between the key words? Or would you also want to find "Varicellas*"?
If you really want to have substring matches (no complete word search) with excpetions, the only reasonable way I can think of is by using expensive combinations of comparisons of CHARINDEX for each exception and each corresponding postiive match using the starting position, and checking if there is a overlap (by using the position and length).
If you can use the Fulltext SQL Server feature, it would be of big help. That feature is meant for fast contextual searches..
Maybe you should go the easy way and retrieve all matching rows without considering exceptions, and then filter the results by algoritihm on the client or in a stored procedure.
If you really want to have substring matches (no complete word search) with excpetions, the only reasonable way I can think of is by using expensive combinations of comparisons of CHARINDEX for each exception and each corresponding postiive match using the starting position, and checking if there is a overlap (by using the position and length).
If you can use the Fulltext SQL Server feature, it would be of big help. That feature is meant for fast contextual searches..
Maybe you should go the easy way and retrieve all matching rows without considering exceptions, and then filter the results by algoritihm on the client or in a stored procedure.
ASKER
@Qlemo,
In addition we are limited for features compatible to SQL 2005 version..
@Bob,
Let me know if you have something in t-sql for it.
Thanks,
Ben
Isn't there any delimiter between the key words? Or would you also want to find "VaricellasIn my case there is no Varicellas, its either varicella or varicella_lab, and I basically want to exclude varicella_lab from the results.
If you can use the Fulltext SQL Server feature, it would be of big help.Not sure what do I have to do in order to utilize this feature? would also want know what are the pros and cons of it..
In addition we are limited for features compatible to SQL 2005 version..
and then filter the results by algoritihm on the client or in a stored procedureWhat better logic would I have for the FE to handle this?
@Bob,
Let me know if you have something in t-sql for it.
Thanks,
Ben
I basically want to exclude varicella_lab from the results.
Pls try this for T-SQL.
CREATE TABLE testLikes
(
Vals VARCHAR(MAX)
)
GO
INSERT INTO testLikes VALUES ('Varicella'),('Varicella_lab')
GO
SELECT * FROM testLikes
WHERE (Vals LIKE '%Varicella%') AND (Vals NOT LIKE '%Varicella_lab%')
Output
/*------------------------
SELECT * FROM testLikes
WHERE (Vals LIKE '%Varicella%') AND (Vals NOT LIKE '%Varicella_lab%')
------------------------*/
Vals
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Varicella
(1 row(s) affected)
Hope it helps !!
ASKER
Hi Pawan,
The story is as follows, we have a function that returns all documents that are needed for specific employee in one long string,
Now if lets say we have the following 3 records
"Varicella, Varicella_lab"
"Varicella, Other doc"
"Varicella_Lab, Other Doc"
And I filter for Varicella, I want want to see the first two records, as they both contains Varicella, while the last record has only Varicella_Lab which is a diff doc.
Thanks,
Ben
The story is as follows, we have a function that returns all documents that are needed for specific employee in one long string,
Now if lets say we have the following 3 records
"Varicella, Varicella_lab"
"Varicella, Other doc"
"Varicella_Lab, Other Doc"
And I filter for Varicella, I want want to see the first two records, as they both contains Varicella, while the last record has only Varicella_Lab which is a diff doc.
Thanks,
Ben
Ok,,
Can you please try like this..
Hope it helps !!
Can you please try like this..
SELECT * FROM testLikes WHERE (Vals LIKE '%Varicella,%')
Hope it helps !!
ASKER
Ok that did work for this example, actually originally I had tried that, just got stuck with the various values that can be after the wording, as some times it has Varicella with ';' and some times when its the last doc then its only Varicella without any character..
Perhaps you have a way to handle those as well?
Thanks,
Ben
Perhaps you have a way to handle those as well?
Thanks,
Ben
Can you please post few different examples and the expected output?
ASKER
At the moment I only remember those
"Varicella, Varicella_lab"
"Varicella, Other doc"
"Varicella_Lab, Other Doc"
"Varicella"
"Other Doc, Varicella; Varicella_Lab"
from those, only #3 is to be excluded.
Thanks,
Ben
"Varicella, Varicella_lab"
"Varicella, Other doc"
"Varicella_Lab, Other Doc"
"Varicella"
"Other Doc, Varicella; Varicella_Lab"
from those, only #3 is to be excluded.
Thanks,
Ben
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Pawan,
This latest looks like working, however I will need to test it with actuall data, will do it tom at work & let u knowץ
Thanks,
Ben
This latest looks like working, however I will need to test it with actuall data, will do it tom at work & let u knowץ
Thanks,
Ben
i was going to suggest regular expressions ...
but with mssql you'll have to create an UDF to support this first
https://blogs.msdn.microsoft.com/khen1234/2005/05/11/regular-expressions-in-t-sql/
after that, just search for your literal with this where clause:
the regex searches yourcolumn text for yourliteral without any extra character
but with mssql you'll have to create an UDF to support this first
https://blogs.msdn.microsoft.com/khen1234/2005/05/11/regular-expressions-in-t-sql/
after that, just search for your literal with this where clause:
WHERE dbo.fn_regex(‘yourliteral[^\w]’,yourcolumn)<>0
the regex searches yourcolumn text for yourliteral without any extra character
ASKER
@Pawan,
Sorry for the delay, hope to be in office shortly & test it.
@Greet,
What does it offer better than Pawan's suggestion, would it perform faster?
P.S. if that works it may be a benefit for me as its shortening the code, see below what I have to do..
Thanks,
Ben
Sorry for the delay, hope to be in office shortly & test it.
@Greet,
What does it offer better than Pawan's suggestion, would it perform faster?
P.S. if that works it may be a benefit for me as its shortening the code, see below what I have to do..
SELECT * FROM fn_frmJcahoReportsFrm(562,571) WHERE Facility1_LastDay >= '10/11/2016' And (MissingDocs like '%Missing License%[^_]%' Or MissingDocs like '%Missing License' Or MissingDocs like '%Missing Malpractice%[^_]%' Or MissingDocs like '%Missing Malpractice' Or MissingDocs like '%Missing BCLS%[^_]%' Or MissingDocs like '%Missing BCLS' Or MissingDocs like '%Missing ACLS%[^_]%' Or MissingDocs like '%Missing ACLS' Or MissingDocs like '%Missing Nals%[^_]%' Or MissingDocs like '%Missing Nals' Or MissingDocs like '%Missing PALS%[^_]%' Or MissingDocs like '%Missing PALS' Or MissingDocs like '%Missing Physical%[^_]%' Or MissingDocs like '%Missing Physical' Or MissingDocs like '%Missing PPD%[^_]%' Or MissingDocs like '%Missing PPD' Or MissingDocs like '%Missing Chest X-Ray%[^_]%' Or MissingDocs like '%Missing Chest X-Ray' Or MissingDocs like '%Missing Measles%[^_]%' Or MissingDocs like '%Missing Measles' Or MissingDocs like '%Missing Rubella%[^_]%' Or MissingDocs like '%Missing Rubella' Or MissingDocs like '%Mis
sing Varicella%[^_]%' Or MissingDocs like '%Missing Varicella' Or MissingDocs like '%Missing Drug Screen WG%[^_]%' Or MissingDocs like '%Missing Drug Screen WG' Or MissingDocs like '%Missing Mumps%[^_]%' Or MissingDocs like '%Missing Mumps' Or MissingDocs like '%Missing Drug Screen%[^_]%' Or MissingDocs like '%Missing Drug Screen' Or MissingDocs like '%Missing Crim chk%[^_]%' Or MissingDocs like '%Missing Crim chk' Or MissingDocs like '%Missing I-9%[^_]%' Or MissingDocs like '%Missing I-9') ORDER BY JcahoDueDate
Thanks,
Ben
I had RegEx is mind too, but as correctly stated MSSQL doesn not support in a query natively. Using an UDF or front end logic is not faster than using direct query expressions. So if we can use them, we should. Only if you need to be very flexible we should conisder using advanced techniques, which always come with performance penalities.
So we have a delimiter - it is either the start/end of string, or a comma. This allows for exact matches. We just have to add delimiters to start and and end of the varchar field before comparing.
So we have a delimiter - it is either the start/end of string, or a comma. This allows for exact matches. We just have to add delimiters to start and and end of the varchar field before comparing.
where ',' + vals + ',' like '%,Varicella,' and ',' + vals + ',' not like '%,Varicalla_lab,%'
This can be changed without much effort to compare against a database table containing the strings to include and exclude.
ASKER
Qlemo,
Besides we also have option to include ";" (when its the end of a group), how will you handle that?
So far Pawan's suggestion seems to work
Thanks,
Ben
not like '%,Varicalla_lab,%'As stated, we have possibility to include both "Varicella, Varicella_Lab" in field, and in this case we want that to be included, dont think that's true with your code.
Besides we also have option to include ";" (when its the end of a group), how will you handle that?
So far Pawan's suggestion seems to work
Vals LIKE '%Varicella[^_]%' OR Vals like '%Varicella'
(in middle testing it with our app), Do you foresee any problem with that?Thanks,
Ben
Sorry I was slightly confused. Because of the delimiters we do not need the exclusion list/expression at all.
Including semi-colons as alternative delimiter is not difficult:
Including semi-colons as alternative delimiter is not difficult:
where ',' + vals + ',' like '%[,;]Varicella[,;]'
and this is still more flexible then Pawan's suggestion.
ASKER
@Qlemo,
It doesn't work, tested with following values.
Varicella, Varicella_lab
Varicella, Other doc
Varicella_Lab, Other Doc
Varicella
;Missing Measles_lab ;Missing Mumps_lab ;Missing Rubella_lab ;Missing Varicella_lab ;Not Signed Bcls ;
Thanks,
Ben
It doesn't work, tested with following values.
Varicella, Varicella_lab
Varicella, Other doc
Varicella_Lab, Other Doc
Varicella
;Missing Measles_lab ;Missing Mumps_lab ;Missing Rubella_lab ;Missing Varicella_lab ;Not Signed Bcls ;
Thanks,
Ben
Hi Ben,
Whats the update? Is my solution working?
Thank you.
Whats the update? Is my solution working?
Thank you.
ASKER
Hi Pawan,
You came in the right time-:)
still trying to figure out why is your solution not working in my app..?
here is what its running
"Missing: Measles_lab, Mumps_lab, Rubella_lab, Varicella_lab, Dementia;
Will Expire: Bcls, Performance Evaluation"
Thanks,
Ben
You came in the right time-:)
still trying to figure out why is your solution not working in my app..?
here is what its running
SELECT * FROM fn_frmJcahoReportsFrm(562,571)
WHERE Facility1_LastDay >= '10/11/2016'
And (MissingDocs like '%Missing License%[^_]%'
Or MissingDocs like '%Missing License'
Or MissingDocs like '%Missing Malpractice%[^_]%'
Or MissingDocs like '%Missing Malpractice'
Or MissingDocs like '%Missing BCLS%[^_]%'
Or MissingDocs like '%Missing BCLS'
Or MissingDocs like '%Missing ACLS%[^_]%'
Or MissingDocs like '%Missing ACLS'
Or MissingDocs like '%Missing Nals%[^_]%'
Or MissingDocs like '%Missing Nals'
Or MissingDocs like '%Missing PALS%[^_]%'
Or MissingDocs like '%Missing PALS'
Or MissingDocs like '%Missing Physical%[^_]%'
Or MissingDocs like '%Missing Physical'
Or MissingDocs like '%Missing PPD%[^_]%'
Or MissingDocs like '%Missing PPD'
Or MissingDocs like '%Missing Chest X-Ray%[^_]%'
Or MissingDocs like '%Missing Chest X-Ray'
Or MissingDocs like '%Missing Measles%[^_]%'
Or MissingDocs like '%Missing Measles'
Or MissingDocs like '%Missing Rubella%[^_]%'
Or MissingDocs like '%Missing Rubella'
Or MissingDocs like '%Missing Varicella%[^_]%'
Or MissingDocs like '%Missing Varicella'
Or MissingDocs like '%Missing Drug Screen WG%[^_]%'
Or MissingDocs like '%Missing Drug Screen WG'
Or MissingDocs like '%Missing Mumps%[^_]%'
Or MissingDocs like '%Missing Mumps'
Or MissingDocs like '%Missing Drug Screen%[^_]%'
Or MissingDocs like '%Missing Drug Screen'
Or MissingDocs like '%Missing Crim chk%[^_]%'
Or MissingDocs like '%Missing Crim chk'
Or MissingDocs like '%Missing I-9%[^_]%'
Or MissingDocs like '%Missing I-9')
ORDER BY JcahoDueDate
and why do I get following record ? (all one field)"Missing: Measles_lab, Mumps_lab, Rubella_lab, Varicella_lab, Dementia;
Will Expire: Bcls, Performance Evaluation"
Thanks,
Ben
Hi,
Pls try this. This may be because we have many other chrs in between.
Pls try this. This may be because we have many other chrs in between.
SELECT * FROM fn_frmJcahoReportsFrm(562,571)
WHERE Facility1_LastDay >= '10/11/2016'
And (MissingDocs like '%Missing License%[^_]%'
Or MissingDocs like '%Missing License'
Or MissingDocs like '%Missing Malpractice%[^_]%'
Or MissingDocs like '%Missing Malpractice'
Or MissingDocs like '%Missing BCLS%[^_]%'
Or MissingDocs like '%Missing BCLS'
Or MissingDocs like '%Missing ACLS%[^_]%'
Or MissingDocs like '%Missing ACLS'
Or MissingDocs like '%Missing Nals%[^_]%'
Or MissingDocs like '%Missing Nals'
Or MissingDocs like '%Missing PALS%[^_]%'
Or MissingDocs like '%Missing PALS'
Or MissingDocs like '%Missing Physical%[^_]%'
Or MissingDocs like '%Missing Physical'
Or MissingDocs like '%Missing PPD%[^_]%'
Or MissingDocs like '%Missing PPD'
Or MissingDocs like '%Missing Chest X-Ray%[^_]%'
Or MissingDocs like '%Missing Chest X-Ray'
Or MissingDocs like '%Missing Measles%[^_]%'
Or MissingDocs like '%Missing Measles'
Or MissingDocs like '%Missing Rubella%[^_]%'
Or MissingDocs like '%Missing Rubella'
Or MissingDocs like '%Missing Varicella%[^_]%'
Or MissingDocs like '%Missing Varicella'
Or MissingDocs like '%Missing Drug Screen WG%[^_]%'
Or MissingDocs like '%Missing Drug Screen WG'
Or MissingDocs like '%Missing Mumps%[^_]%'
Or MissingDocs like '%Missing Mumps'
Or MissingDocs like '%Missing Drug Screen%[^_]%'
Or MissingDocs like '%Missing Drug Screen'
Or MissingDocs like '%Missing Crim chk%[^_]%'
Or MissingDocs like '%Missing Crim chk'
Or MissingDocs like '%Missing I-9%[^_]%'
Or MissingDocs like '%Missing I-9')
AND MissingDocs NOT LIKE '%, Varicella_lab,%'
ORDER BY JcahoDueDate
ASKER
P.S. after we get this to work, if you can get this code shortened I would appreciate as it looks humongous..
Thanks,
Ben
Thanks,
Ben
Sure Ben ! I shall try to make it small.
ASKER
Not sure what you did, but by copy/paste I didnt got any records..
lets try focus on one record first
running the following
;Missing Measles_lab ;Missing Mumps_lab ;Missing Rubella_lab ;Missing Varicella_lab ;Missing Orientation Documentation ;Missing Attestation Form ;Missing Tetanus ;Will Expire Malpractice ;
Which should not belong there..
Thanks,
Ben
lets try focus on one record first
running the following
SELECT * FROM fn_frmJcahoReportsFrm(562,571)
WHERE Facility1_LastDay >= '10/12/2016'
And (MissDocWithStatus like '%Missing License%[^_]%'
Or MissDocWithStatus like '%Missing License'
Or MissDocWithStatus like '%Missing Malpractice%[^_]%'
Or MissDocWithStatus like '%Missing Malpractice'
Or MissDocWithStatus like '%Missing BCLS%[^_]%'
Or MissDocWithStatus like '%Missing BCLS'
Or MissDocWithStatus like '%Missing ACLS%[^_]%'
Or MissDocWithStatus like '%Missing ACLS'
Or MissDocWithStatus like '%Missing Nals%[^_]%'
Or MissDocWithStatus like '%Missing Nals'
Or MissDocWithStatus like '%Missing PALS%[^_]%'
Or MissDocWithStatus like '%Missing PALS'
Or MissDocWithStatus like '%Missing Physical%[^_]%'
Or MissDocWithStatus like '%Missing Physical'
Or MissDocWithStatus like '%Missing PPD%[^_]%'
Or MissDocWithStatus like '%Missing PPD'
Or MissDocWithStatus like '%Missing Chest X-Ray%[^_]%'
Or MissDocWithStatus like '%Missing Chest X-Ray'
Or MissDocWithStatus like '%Missing Measles%[^_]%'
Or MissDocWithStatus like '%Missing Measles' Or MissDocWithStatus like '%Missing Rubella%[^_]%' Or MissDocWithStatus like '%Missing Rubella' Or MissDocWithStatus like '%Missing Varicella%[^_]%' Or MissDocWithStatus like '%Missing Varicella' Or MissDocWithStatus like '%Missing Drug Screen WG%[^_]%' Or MissDocWithStatus like '%Missing Drug Screen WG' Or MissDocWithStatus like '%Missing Mumps%[^_]%' Or MissDocWithStatus like '%Missing Mumps' Or MissDocWithStatus like '%Missing Drug Screen%[^_]%' Or MissDocWithStatus like '%Missing Drug Screen' Or MissDocWithStatus like '%Missing Crim chk%[^_]%' Or MissDocWithStatus like '%Missing Crim chk' Or MissDocWithStatus like '%Missing I-9%[^_]%' Or MissDocWithStatus like '%Missing I-9')
-- ORDER BY JcahoDueDate
and id = 119508
I got this record;Missing Measles_lab ;Missing Mumps_lab ;Missing Rubella_lab ;Missing Varicella_lab ;Missing Orientation Documentation ;Missing Attestation Form ;Missing Tetanus ;Will Expire Malpractice ;
Which should not belong there..
Thanks,
Ben
ASKER
Sure Ben ! I shall try to make it small.Well I see this is turning not to be an easy task..therefore I will post another question after finishing this, on how to make that smaller..
Thanks,
Ben
Hi,
Pls try this..
Hope it helps !
Pls try this..
SELECT * FROM
(
SELECT * FROM fn_frmJcahoReportsFrm(562,571)
WHERE Facility1_LastDay >= '10/11/2016'
And (MissingDocs like '%Missing License%[^_]%'
Or MissingDocs like '%Missing License'
Or MissingDocs like '%Missing Malpractice%[^_]%'
Or MissingDocs like '%Missing Malpractice'
Or MissingDocs like '%Missing BCLS%[^_]%'
Or MissingDocs like '%Missing BCLS'
Or MissingDocs like '%Missing ACLS%[^_]%'
Or MissingDocs like '%Missing ACLS'
Or MissingDocs like '%Missing Nals%[^_]%'
Or MissingDocs like '%Missing Nals'
Or MissingDocs like '%Missing PALS%[^_]%'
Or MissingDocs like '%Missing PALS'
Or MissingDocs like '%Missing Physical%[^_]%'
Or MissingDocs like '%Missing Physical'
Or MissingDocs like '%Missing PPD%[^_]%'
Or MissingDocs like '%Missing PPD'
Or MissingDocs like '%Missing Chest X-Ray%[^_]%'
Or MissingDocs like '%Missing Chest X-Ray'
Or MissingDocs like '%Missing Measles%[^_]%'
Or MissingDocs like '%Missing Measles'
Or MissingDocs like '%Missing Rubella%[^_]%'
Or MissingDocs like '%Missing Rubella'
Or MissingDocs like '%Missing Varicella%[^_]%'
Or MissingDocs like '%Missing Varicella'
Or MissingDocs like '%Missing Drug Screen WG%[^_]%'
Or MissingDocs like '%Missing Drug Screen WG'
Or MissingDocs like '%Missing Mumps%[^_]%'
Or MissingDocs like '%Missing Mumps'
Or MissingDocs like '%Missing Drug Screen%[^_]%'
Or MissingDocs like '%Missing Drug Screen'
Or MissingDocs like '%Missing Crim chk%[^_]%'
Or MissingDocs like '%Missing Crim chk'
Or MissingDocs like '%Missing I-9%[^_]%'
Or MissingDocs like '%Missing I-9')
)p WHERE MissingDocs NOT LIKE '%Missing: Measles_lab, Mumps_lab, Rubella_lab, Varicella_lab, Dementia;'
ORDER BY JcahoDueDate
Hope it helps !
ASKER
Again I dont get any records..even with the inner select.
Thanks,
Ben
Thanks,
Ben
Check this first .. Are you getting anything from below?
SELECT * FROM fn_frmJcahoReportsFrm(562,571)
WHERE Facility1_LastDay >= '10/11/2016'
ASKER
of course I get.
the above I pasted last has record/s.
Thanks,
Ben
the above I pasted last has record/s.
Thanks,
Ben
Hi,
Pls check this.. If works the uncomment the where clause. <<I have added ID in the inner query.>>
Pls check this.. If works the uncomment the where clause. <<I have added ID in the inner query.>>
SELECT * FROM
(
SELECT * FROM fn_frmJcahoReportsFrm(562,571)
WHERE Facility1_LastDay >= '10/11/2016'
And (
MissingDocs like '%Missing License%[^_]%'
Or MissingDocs like '%Missing License'
Or MissingDocs like '%Missing Malpractice%[^_]%'
Or MissingDocs like '%Missing Malpractice'
Or MissingDocs like '%Missing BCLS%[^_]%'
Or MissingDocs like '%Missing BCLS'
Or MissingDocs like '%Missing ACLS%[^_]%'
Or MissingDocs like '%Missing ACLS'
Or MissingDocs like '%Missing Nals%[^_]%'
Or MissingDocs like '%Missing Nals'
Or MissingDocs like '%Missing PALS%[^_]%'
Or MissingDocs like '%Missing PALS'
Or MissingDocs like '%Missing Physical%[^_]%'
Or MissingDocs like '%Missing Physical'
Or MissingDocs like '%Missing PPD%[^_]%'
Or MissingDocs like '%Missing PPD'
Or MissingDocs like '%Missing Chest X-Ray%[^_]%'
Or MissingDocs like '%Missing Chest X-Ray'
Or MissingDocs like '%Missing Measles%[^_]%'
Or MissingDocs like '%Missing Measles'
Or MissingDocs like '%Missing Rubella%[^_]%'
Or MissingDocs like '%Missing Rubella'
Or MissingDocs like '%Missing Varicella%[^_]%'
Or MissingDocs like '%Missing Varicella'
Or MissingDocs like '%Missing Drug Screen WG%[^_]%'
Or MissingDocs like '%Missing Drug Screen WG'
Or MissingDocs like '%Missing Mumps%[^_]%'
Or MissingDocs like '%Missing Mumps'
Or MissingDocs like '%Missing Drug Screen%[^_]%'
Or MissingDocs like '%Missing Drug Screen'
Or MissingDocs like '%Missing Crim chk%[^_]%'
Or MissingDocs like '%Missing Crim chk'
Or MissingDocs like '%Missing I-9%[^_]%'
Or MissingDocs like '%Missing I-9')
and id = 119508
)p --WHERE MissingDocs NOT LIKE '%Missing: Measles_lab, Mumps_lab, Rubella_lab, Varicella_lab, Dementia;'
ORDER BY JcahoDueDate
ASKER
Nothing at all..see attached.
FYI- I will not be in office next two hours, will reply again upon return.
Thanks,
Ben
Untitled.png
FYI- I will not be in office next two hours, will reply again upon return.
Thanks,
Ben
Untitled.png
ASKER
Hi Pawan,
Any hope for us?
Thanks,
Ben
Any hope for us?
Thanks,
Ben
ASKER
OK I was able to boil down to the following like.
appear on results?
Thanks,
Ben
Or MissDocWithStatus like '%Missing Measles%[^_]%'
Now my question is, why should a record with MissDocWithStatus = ';Missing Measles_lab ;Missing Mumps_lab ;Missing Rubella_lab ;Missing Varicella_lab ;Missing Orientation Documentation ;Missing Attestation Form ;Missing Tetanus ;Will Expire Malpractice ;' appear on results?
Thanks,
Ben
ASKER
Just to clarify, even when I run the following that record still shows up.
Thanks,
Ben
Untitled.png
SELECT MissDocWithStatus FROM fn_frmJcahoReportsFrm(562,571)
WHERE Facility1_LastDay >= '10/1/2016'
and MissDocWithStatus like '%Missing Measles%[,;]%'
and id = 119508
See attached.Thanks,
Ben
Untitled.png
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi try this..
--You can uncomment where clause based on the need.
Hope it helps !!
--You can uncomment where clause based on the need.
SELECT * FROM
(
SELECT * FROM fn_frmJcahoReportsFrm(562,571)
WHERE Facility1_LastDay >= '10/11/2016'
And (
MissingDocs like '%Missing License[^_]%'
Or MissingDocs like '%Missing License'
Or MissingDocs like '%Missing Malpractice[^_]%'
Or MissingDocs like '%Missing Malpractice'
Or MissingDocs like '%Missing BCLS[^_]%'
Or MissingDocs like '%Missing BCLS'
Or MissingDocs like '%Missing ACLS[^_]%'
Or MissingDocs like '%Missing ACLS'
Or MissingDocs like '%Missing Nals[^_]%'
Or MissingDocs like '%Missing Nals'
Or MissingDocs like '%Missing PALS[^_]%'
Or MissingDocs like '%Missing PALS'
Or MissingDocs like '%Missing Physical[^_]%'
Or MissingDocs like '%Missing Physical'
Or MissingDocs like '%Missing PPD[^_]%'
Or MissingDocs like '%Missing PPD'
Or MissingDocs like '%Missing Chest X-Ray[^_]%'
Or MissingDocs like '%Missing Chest X-Ray'
Or MissingDocs like '%Missing Measles[^_]%'
Or MissingDocs like '%Missing Measles'
Or MissingDocs like '%Missing Rubella[^_]%'
Or MissingDocs like '%Missing Rubella'
Or MissingDocs like '%Missing Varicella[^_]%'
Or MissingDocs like '%Missing Varicella'
Or MissingDocs like '%Missing Drug Screen WG[^_]%'
Or MissingDocs like '%Missing Drug Screen WG'
Or MissingDocs like '%Missing Mumps[^_]%'
Or MissingDocs like '%Missing Mumps'
Or MissingDocs like '%Missing Drug Screen[^_]%'
Or MissingDocs like '%Missing Drug Screen'
Or MissingDocs like '%Missing Crim chk[^_]%'
Or MissingDocs like '%Missing Crim chk'
Or MissingDocs like '%Missing I-9[^_]%'
Or MissingDocs like '%Missing I-9')
and id = 119508
)p --WHERE MissingDocs NOT LIKE '%Missing: Measles_lab, Mumps_lab, Rubella_lab, Varicella_lab, Dementia;'
ORDER BY JcahoDueDate
Hope it helps !!
ASKER
Hi Experts,
Users are testing now, should get results shortly..
Thanks,
Ben
Users are testing now, should get results shortly..
Thanks,
Ben
ASKER
Thank you guys, great job!
Welcome Ben !!
Open in new window