473,508 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Select records with multiple conditions

Hi,
I am working with a ticket database that stores the problem reported. Each ticket can have multiple problems reported. I am trying to filter out certain tickets.

Basically, I want to be able to only have those tickets that have a problem reported of No Loss of Service and See Remarks. Then i want to concatenate these problems into one field so that I have one line per ticket. Is there a way to do that.

Here is an example of my table:

TKT_CRTE_DATE TKT_NUM TKT_SK PROB_RPT
1/1/2010 1:06:00 PM 266 10567134 Customer checked breaker
1/1/2010 1:06:00 PM 266 10567134 See Remarks
1/1/2010 2:56:00 PM 352 10567220 No Loss of Service
1/1/2010 3:23:00 PM 475 10567344 Confirmed Out Of Service
1/2/2010 6:31:00 AM 46 10567811 See Remarks
1/2/2010 8:29:00 AM 99 10567864 No Loss of Service
1/3/2010 12:06:00 AM 2 10568376 Fire/Police
1/3/2010 12:06:00 AM 2 10568376 No Loss of Service
1/3/2010 12:06:00 AM 2 10568376 See Comments
1/3/2010 9:09:00 PM 547 10568921 See Remarks
1/4/2010 10:38:00 AM 455 10569418 No Loss of Service
1/4/2010 10:38:00 AM 455 10569418 See Remarks
Oct 6 '10 #1
1 3657
Frinavale
9,735 Recognized Expert Moderator Expert
Write a SQL query that Selects everything from the table that has a title of Loss of Service Or See Remarks...

Something like:
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM MyTicketTable 
  2. WHERE PROB_RPT = 'Loss of Service' OR PROB_RPT = 'See Remarks'
This will return you all records that have a Problem Reported as Loss of Service or See Remarks.

From there you should loop through the records and do your concatenation logic.

-Frinny
Oct 6 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
66843
by: M Wells | last post by:
Hi All, Just wondering if anyone can tell me if you can test for multiple conditions as part of an "IF" statement in T-SQL in SQL Server 2000? ie something like: IF @merr = 1 or @merr=2...
6
18748
by: Ian Davies | last post by:
Hello all I have the following PHP script to place records from my MySql db into a table. However I now wish users to beable to select the multiple records from the table and on clicking a button...
2
453
by: Danny | last post by:
How to allow users to select a set of records and then let them change a field for all these records at once? I would like to do this in code on a form. I will have a form with tabular view of...
1
2637
by: arthur-e | last post by:
How can you select records based on more than one combo box - I have a combobox that selects records based on name (I'm sure this has been asked a thousand times - web site answer/link could be...
1
1841
by: Dan Sikorsky | last post by:
How do you select records from one dataset and create a second dataset? I need to pull out the master records from a dataset and create a master datagrid in which to embed a details datagrid (for...
1
2284
by: Work.Smarter.1 | last post by:
How do i subtract the first value from the second value without multiple queries? (query example below) SELECT Sum(tbl_Area_PropLend.Amount) AS Default_FinCharge FROM tbl_Area_PropLend GROUP BY...
1
1967
by: francophone77 | last post by:
What is the best way to setup a query to select records in specific months only. For instance if I want to compare sales in the month of May regardless of year. TIA
3
18170
by: kavithapotnuru | last post by:
Hi All, Can anyone help me how to give multiple conditions in a while loop in perl. For example i have a while loop for which the value of a variable is A or B it should not enter in to the...
2
1894
by: Hamayun Khan | last post by:
Hi all I am using the following query to select records for table Select JobTitle,JobDesc,Scraped,logoimage,JobPostID,SchoolID,web,MemType,InstitutionName,PayScale,LEA,Contract as...
2
3602
by: rkferguson | last post by:
Hi Folks, I have a table that captures information about documents that leave the office. Some of those documents may get a signature and then return to the office. Need away to query the...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7385
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1558
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.