Get Distinct rows from multiple columns

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Manikgisl
    New Member
    • Oct 2008
    • 37

    #1

    Get Distinct rows from multiple columns

    I have a result ie.,
    RecID Name ID1 ID2 ID3
    1 OP014B_80460_01 3 1092 1743 1500
    2 OP014B_80460_01 3 1743 1092 1500
    3 OP014B_80461_00 1 1092 1774 1500
    4 OP014B_80461_00 1 1774 1092 1500

    From this i need to get result..
    RecID Name ID1 ID2 ID3
    2 OP014B_80460_01 3 1743 1092 1500
    4 OP014B_80461_00 1 1774 1092 1500


    Since 2 & 4 is the max intrecid

    My query is
    SELECT distinct(vchLot name) as Lot1,intAllotte dTo, intReAllottedTo , intReAllottedBy FROM tbReAllottedLot s WHERE
    vchbatch='bt080 9-11b' AND intPurposeID=1 ORDER BY vchLotName

    How do i get the distinct from this

    Thanks in Advance Happy new year...

    Mani - Mani
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    When you say

    Since 2 & 4 is the max intrecid
    Do you mean max ID?

    -- CK

    Comment

    Working...