|
-
Jun 26th, 2000, 03:00 AM
#1
Here is a problem I am trying to solve:
I have a set of data, and I am trying to grab the data with the most recent changes made to it using a date reference. My problem is that the distinct will only let me get one field, which is not my unique ID field. I need to be able to get all of the data for each row but only get the unique rows.
Code:
SELECT DISTINCT dbtNAME FROM myTAble
This code gets the two records but only retrieves the field named dbtNAME and I need all of the columns.
Code:
SELECT DISTINCT dbtName,* FROM myTable
This code grabs all records from myTable
I am using SQL 7.0, VB 5.0, and ADO 2.1
Thanks in advnace
-
Jun 26th, 2000, 04:51 AM
#2
Frenzied Member
6.5 likes:
SELECT DISTINCT(dbtName),* FROM myTable
-
Jun 26th, 2000, 06:50 PM
#3
SELECT DISTINCT(dbtName),* FROM myTable
I have already tried this and the DISTINCT command also runs on the * so it returns all of the records.
Thanks anyways
-
Jun 26th, 2000, 09:34 PM
#4
Probably this is clumsy but:
select distinct(col1 + col2), col1, col2 from tablename
would select just the distinct rows.
-
Jun 26th, 2000, 11:09 PM
#5
Frenzied Member
Originally posted by Negative0
SELECT DISTINCT(dbtName),* FROM myTable
I have already tried this and the DISTINCT command also runs on the * so it returns all of the records.
Thanks anyways
Then 7.0 works differently than 6.5 because an equivalent statement returns one row per unique item, in my case (although I'm not sure it always returns the row I want).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|