Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get results for multiple rows? 1

Status
Not open for further replies.

rrsub

MIS
Oct 23, 2002
536
US
I thought this would have been a simple query but I'm stuck.

I have a table that has a field that should have unique data but doesn't. I'm trying to get results that will return only the rows that have data that has more than one unique value.

So if field A has values

20
30
30
40
50
50
50


I only want rows that have more that the one unique value, in this case, the rows with 30 and 50.



 
Something like this....

Code:
[COLOR=blue]Select[/color] FieldA
[COLOR=blue]From[/color]   [COLOR=blue]Table[/color]
[COLOR=blue]Group[/color] [COLOR=blue]By[/color] FieldA
[COLOR=blue]Having[/color] [COLOR=#FF00FF]Count[/color](*) > 1

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
It was the 'HAVING' that escaped me.

 
You'd be surprised at how many people it escapes. I'm glad I was able to help.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
I am trying to setup a query that will retrieve all persons in a certain city and state and include their sales if they had any or not for the current year. They may have had sales in previous year or none at all. I am thinking that a subquery would be my best step but was wondering if anyone had any other ideas.

Thanks
 
dscoiho, start a new thread please (with some details as well and all relevant code that you have attempted that needs to be looked at for help)

____________ signature below ______________
The worst mistake you'll ever make is to do something simply the way you know how while ignoring the way it should be done
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top