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

MS Access 97 question

Status
Not open for further replies.

dbadmin

Programmer
Jan 3, 2003
147
US
I have a table Table1 with data like below

id text
--------------------
1 btest1
2 btest1
3 atest2
4 btest1
5 atest2
6 atest2

I need to write a query which will give me the min of id group by the text column. It goes like this

SELECT min(id), text
FROM Table1
GROUP BY text;

The result
-----------
Expr1000 text

3 atest2
1 btest1

This works fine, but when I try to order it by the first column in the resultset, I am getting error. My query looks like this

SELECT min(id), text
FROM Table1
GROUP BY text
ORDER BY min(id);

I tried the same query in Access 2000 and it works fine. Is there any work around for this in Access 97. I need the reultset like this

Expr1000 text

1 btest1
3 atest2

Thanks,
dbadmin
 
Hi,

Not sure why the sql isn't happy, but try replacing
ORDER BY min(id);

with
ORDER BY 1;

(I find this is often a handy syntax)


Cheers

S
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top