Kamis, 16 Mei 2013

Re: [MS_AccessPros] Re: filtering to show anyone who has multiple items

 

Peleg, I tried what you had suggested and it did not seem to work properly. It did display results but many people displayed still only had one service. Here is what my code looked like once I tried to convert what you said to my tables. 
 
SELECT dbo_CONSUMERS.CLIENT_ID, dbo_CONSUMERS.FIRST_NAME, dbo_CONSUMERS.LAST_NAME WHERE dbo_SERVICE_DELIVERIES.SERVICE Like "*homemaker*"
UNION SELECT dbo_CONSUMERS.CLIENT_ID, dbo_CONSUMERS.FIRST_NAME, dbo_CONSUMERS.LAST_NAME WHERE dbo_SERVICE_DELIVERIES.SERVICE Like "*personal*";
 

 

________________________________
From: Peleg <lists@pstrauss.net>
To: MS_Access_Professionals@yahoogroups.com
Sent: Friday, May 10, 2013 5:57 PM
Subject: [MS_AccessPros] Re: filtering to show anyone who has multiple items

 

Try this:

Select Id, Name, Service From TableName Where Service = "Service1"
Union
Select Id, Name, Service From TableName Where Service = "Service2"

--- In mailto:MS_Access_Professionals%40yahoogroups.com, "Dale C" wrote:
>
> I have Access 2002 and I have a basic query and can't seem to get the
filtering to yield the correct results without creating two queries and
comparing those. Here are the fields I have: ID, Name, Service
> The Service would contain the actual service name such as Service1,
Service2, Service3, Service4, Service5, etc. If someone gets multiple
services then the main table would have that person stored multiple
times, one line for each service they receive. I am trying to make a
query that shows me anyone who is getting Service1 and Service2. If I
use the filter to be "Service1" AND "Service2" it will not display any
results because technically there is no service name that is called
Service1Service2 since each individual service is outputted to a
separate line. If I use the OR statement it does show anyone who has
Service1 or anyone who has Service2 but does not filter to just those
that actually have the Service1 and a line with Service2. How could I
accomplish this? For example, here would be an example of what the query
outputs without a filter:
> 1235 - John - Service1
> 1235 - John - Service3
> 1235 - John - Service2
> 1236 - Jane - Service1
> 1345 - Stan - Service1
> 1345 - Stan - Service2
> 1654 - Jake - Service2
>
> If I wanted those who had service 1 and a service2 it should output
this:
> 1235 - John - Service1
> 1235 - John - Service2
> 1345 - Stan - Service1
> 1345 - Stan - Service2
>

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar