locked
read distinct values RRS feed

  • Question

  • User496086301 posted

    SELECT Attribute_Name='A',Attribute_Value=distinct(A), Attribute_Value_Order=ROW_NUMBER() OVER (ORDER BY A) FROM TableA

    Distinct doesnot work there.

    Friday, November 16, 2018 9:46 PM

All replies

  • User77042963 posted

    Select Attribute_Name, Attribute_Value,
    ROW_NUMBER() OVER (ORDER BY Attribute_Value) as Attribute_Value_Order
    from (
    SELECT Distinct 'A' as Attribute_Name, [A] as Attribute_Value
    FROM TableA
    ) t

    Friday, November 16, 2018 9:57 PM
  • User496086301 posted

    Select Attribute_Name='A', Attribute_Value,Attribute_Value_Order=ROW_NUMBER() OVER (ORDER BY A)
    from (
    SELECT Distinct A as Attribute_Value
    FROM Table A
    ) t

    getting invalid column @ ROW_NUMBER() OVER (ORDER BY A)

    Friday, November 16, 2018 10:18 PM
  • User77042963 posted

    Select Attribute_Name='A', Attribute_Value,Attribute_Value_Order=ROW_NUMBER() OVER (ORDER BY Attribute_Value)
    from (
    SELECT Distinct A as Attribute_Value 
    FROM Table A
    ) t

    Monday, November 19, 2018 1:51 AM