Wednesday, 26 June 2013

select from table distinct column

SELECT * FROM TABLE WITH DISTINCT COLUMN
---------------------------------------------------------------

SELECT * FROM [TABLE NAME]
WHERE [ID] IN (
  SELECT MIN([ID]) FROM [TABLE NAME] GROUP BY [DISTINCT COLUMN NAME])

Example:

       SELECT FROM [SKILLS] WHERE [ID] IN
       (
      SELECT MIN([ID]) FROM [SKILLS] GROUP BY [SKILL NAME]
       )

No comments:

Post a Comment

Convert SVG to PNG using svg.dll

      <div id="divsvg">        <svg width="350" height="300"><defs></defs> ............