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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dinstinct values for one field of a multiple field query?

Status
Not open for further replies.

Zybron

Programmer
Jul 2, 2003
17
US
Is it possible to structure an SQL query in such a manner that distinct values for one field are retrieved along with data from other fields of a table, or can this only be done with multiple queries?

Zybron
 
The problem with what you are asking is this, Queries return rows of data how do you display or represent in rows only 1 Mike, 1 Jones and 1 Smith.

All Rows
Mike Jones
Mike Smith
Mike Jones
John Smith

Distinct Rows
Mike Smith
Mike Jones
John Smith

Distinct FirstNames
Mike
John

Distinct LastNames
Smith
Jones
 
dvannoy - I saw that thread the other day, downloaded the file, and have been looking through it. I haven't found anything, yet, that would seem to allow what I'm asking, which may mean it's not possible to do with one query, which is why I asked.

Unless, you believe something in that post, like, perhaps, creating a third virtual recordset that consists of the union between a distinct query and the full database is your suggestion.

I'll have to look into that.

DrJavaJoe - The database I'm working with is one that contains data about inventory that includes a part number and various other data about the inventory. Unfortunately, there exists the possibility of each item being listed more than once dependent upon a change in one or more fields. I know, it's a nightmare and certainly not a structure I would have used, but the structure was inherited from a previous program that's still being used for part of the necessary work and changing it now would mean a lot more downtime than I can afford on this project.

So, I've been doing this operation, currently, by querying the distinct part numbers and parsing through them to collect the data that I need, I was just curious if there was a way to combine those steps into one query that would save on the resources and make the program run much faster. It looks like maybe that's not the case.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top