an easy question (1 Viewer)

T

tool2269

Guest
right now i'm working with just one table
for example:

field1 - field2
george - austin
george - dallas
sarah - houston
john - austin
stacey - dallas

how do i set up a query so that when i search for BOTH dallas and austin people, it shows me their names.. and doesnt list their names multiple times
 

Jewellissa

Registered User.
Local time
Today, 16:58
Joined
Jun 26, 2003
Messages
15
Easy Question ??

I didn't find this an easy question.. but I thought about it for a little.. I think some of the problem is because you dont appear to have a Key value or if you do it probably wont help you much in this query. So here is ueber brilliant way to do it.. OKay maybe not..

If you have Access 2000+...

-Create a Make-Table Query of all the ppl from Houston

-Create a Make-Table Query of all the ppl from Dallas

-Create a Find Duplicates Query on both those tables

Voila!

I am ALMOST POSITIVE that Find Duplicates Query were first intro'd in 2000.

Good Luck! If you have less than 2000.. ask again..
Pooh Bear: "Think..Think..think..."

Jewelz
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 16:58
Joined
Feb 19, 2002
Messages
43,233
Find duplicates was around in A97. But that is not the answer here.

If you don't care which city a person came from, add the Distinct keyword to the query and do not include city in the select clause.

Select Distinct field1
From YourTable
Where field2 = "Austin" or field2 = "Dallas";

If you don't really need to know multiple cities but just the first one, then:

Select field1, First(field2)
From YourTable
Where field2 = "Austin" or field2 = "Dallas"
Group By field1;

If you want all the cities returned in a single column, you'll need to write some code. Look up "concatenate many-side" for the link to a knowledge base article with a code sample.
 

Users who are viewing this thread

Top Bottom