Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 table related returns products duplicated and once
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

2 Posts

Posted - 02/08/2013 :  10:47:16  Show Profile  Reply with Quote
Hi, i am using sql serveer 2008, and i have this problem

I have 2 tables:
Table: products
id_code int PK
name_prod varchar(20)

id_produto int
version int PK(id_produto, version)

i need to show the list of products with the latest version.

i made this

select distinct id_code, name, max(version) from produts
left join versions on id_produto = id_code
group by version

but don't work...

any idea?

Thanks in advance

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 02/08/2013 :  10:55:00  Show Profile  Reply with Quote
You may be grouping by the wrong column:
	produts p
	left join versions v on v.id_produto = p.id_code
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000