Solved

exclusive and

Posted on 2014-02-14
4
136 Views
Last Modified: 2014-02-14
Hello expert,

Need to search for cases in cases database. Need to group
all the cases Description that are concerned with DataVault
and then separate them by Incident or Service Request.
The query written is copied herewith below.

The problem is it is not differentiating between Incident
and Service Request cases. I tried adding to the Where clause
([Case type] not LIKE 'Incident')
But the Incident cases are still showing up.

Way of a good way of doing this?

Thanks

Allen in Dallas

++++++++++++++begin of query+++++++++++++++++++
SELECT        ['Raw data$'].*, [Case Type] AS Case_type
FROM            ['Raw data$']
WHERE        ([Description] LIKE 'DataVault backup monitor%')
or
([Description] LIKE 'Datavault Data: BackupStatus.xml%')
or
([Description] LIKE 'Datavault __: BackupStatus.xml%')
or
([Description] LIKE 'Datavault SystemState%')
and
([Case type] LIKE 'Service Request')
and
([Case type] not LIKE 'Incident')

+++++++++++++++end of query+++++++++++++++++
0
Comment
Question by:9apit
  • 3
4 Comments
 
LVL 65

Expert Comment

by:Jim Horn
ID: 39859355
>I tried adding to the Where clause   ([Case type] not LIKE 'Incident')
You need to add a percent sign ( % ) to uses as a wildcard, either to the left or the right or both..

WHERE [Case type] NOT LIKE '%Incident%'
0
 
LVL 65

Accepted Solution

by:
Jim Horn earned 500 total points
ID: 39859358
WHERE this OR that OR those OR these AND that_too AND this_too

btw you may want to consider adding parentheses ( ) to establish order of precedence, if any of these need to be grouped together when doing the AND OR logic, such as..

WHERE (this OR that OR those OR these) AND that_too AND this too
0
 

Author Closing Comment

by:9apit
ID: 39859498
The parenthesis grouping worked. Thanks.
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 39859522
Thanks for the grade.  Good luck with your project.  -Jim
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SELECT query on two levels (detail and summary) 13 50
Update a text value in another table 10 39
Can > be used for a Text field 6 42
SQL Query assistance 16 25
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question