sql server - Sql Query Select One Record -


This is my result.

How do I record top IDs in the same ID? (Query result is 3 records but I want to take top record)

Thank you my code, but I have error (column 'ID' was specified several times for 'CTE'.)

  (RN = Row_NUMBER () with more than (dbo.Picture.UpdatedDate ASC dbo.Product.ID command PARTITION), as in CTE *, * Dbo.Product inbound dbo. Include dbo.Product_Picture_Mapping on Product_Picture_Mapping .include productid = dbo.Product.ID inner dbo.Picture.ID = dbo.Product_Picture_Mapping.PictureID dbo.Picture) Select from * CTE 

Or "down" so you need to specify the column (s) in order to order from you so that However, you can use ROW_NUMBER to get a record per ID

For example (assuming the UPDATEDDATE command-column Form): * Include rbo.Product Interiors from *

  as CTE (= ROW_NUMBER with RN selection) (UPDATEDDATE ASC order by PARTITION, based on ID). ..) Selection from CTE .... Where with UPDATEDDATE DESC RN = 1 Order  

( instead of joining) Did not want to write )


Comments