Home » RDBMS Server » Server Administration » sql query
sql query [message #373545] Mon, 23 April 2001 06:45 Go to next message
arlo
Messages: 2
Registered: April 2001
Junior Member
Bonjour

I've got a database which contains a lot of product/version such as:
product version
A 1
B 1
B 3
C 2
C 4
...

i search to have the list of all the product in their latest version, such as
A 1
B 3
C 4

Does anyone has an idea do this ?
Re: sql query [message #373547 is a reply to message #373545] Mon, 23 April 2001 08:04 Go to previous messageGo to next message
Balamurugan.R
Messages: 91
Registered: March 2001
Member
Hi,

Try this query

select product,version from table_name x where version=(select max(version) from table_name where x.product=product);

Hope this will help u.

Cheers,
Balu
Re: sql query [message #373548 is a reply to message #373545] Mon, 23 April 2001 08:54 Go to previous messageGo to next message
m
Messages: 15
Registered: April 2001
Junior Member
select product, max(version)
from table_name
group by product
all seems working, Thanks to you all [message #373572 is a reply to message #373545] Tue, 24 April 2001 04:21 Go to previous messageGo to next message
arlo
Messages: 2
Registered: April 2001
Junior Member
my table was a little more complex, so i test
only the m' and Balu' queries.

Now, it works and i can go further my dev.

Thanks

Arlo
Re: all seems working, Thanks to you all [message #373625 is a reply to message #373572] Fri, 27 April 2001 10:00 Go to previous messageGo to next message
Balamurugan.R
Messages: 91
Registered: March 2001
Member
Hi,

You told that ur database is very large, so

all the queries submitted to here took too much

time, so I have created another query, it will

take only few minutes to execute and solve your

problem. Try this query,

select product,max(version) from table_name
group by product;

Let me know it works well and it is useful to u.

With Regards,
Balu
sql server [message #374306 is a reply to message #373545] Tue, 05 June 2001 06:54 Go to previous message
jegan
Messages: 2
Registered: June 2001
Junior Member
We have tried to execute a sql query (select query) using sql server query analyser , it will return the records( 88 thousands ). But we were executing the same query in ASP page using recordset object open method and it is giving EOF.

Clarify this query as early as possible.
Previous Topic: How to insert single quote (') in the column of table
Next Topic: Re: How to insert single quote (') in the row of table
Goto Forum:
  


Current Time: Fri Jul 05 08:07:29 CDT 2024