Question : want distinct, newest rows


want row

SELECT distinct name FROM productimagespd WHERE manu is not null


sample data

name1               manu1
name1               manu2
name2               manu3

-------------------
want

name1               manu1
name2               manu3





CREATE TABLE [dbo].[productimagespd](
      [productimagesid] [int] IDENTITY(1,1) NOT NULL,
      [productid] [int] NOT NULL,
      [name] [varchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
      [place] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
      [manu] [varchar](60) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
      [color] [varchar](30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]





select * from (
select row_number() over (partition by name order by manu) rn, p.*
FROM productimagespd p
WHERE manu is not null
)x where rn=1



this code works

but I want to have the <b>newest</b> row
this is the row with the highest number productimageid (identity field)

Answer : want distinct, newest rows

> They appear on a certain X and Y spot on the map.. they are "painted on"

ie. they do have a location

> Well I say that because the tileGen looks for a comand.. so when they send the status of the items out.. it will say NullPointerException or sometihng like that...

you need to add more commands
Random Solutions  
 
programming4us programming4us