SQL Trying to select only the first record out of several returned -
i have query returns students , roommates. idea have show in first column , column 2 , 3 have each roommate. column 3 blank, columns 1 , 2 have results.
my query returning correct data exception of when there 3 people in room, more 1 record. such below.
_roommate1 roommate2 roommate3 room1_ _roommate1 roommate3 roommate2 room1_ _roommate2 roommate1 roommate3 room1_ _roommate2 roommate3 roommate1 room1_ _roommate3 roommate1 roommate2 room1_ _roommate3 roommate2 roommate1 room1_
all want keep first instance of each row when field appears in column 1.
so reduce output to:
_roommate1 roommate2 roommate3 room1_ _roommate2 roommate1 roommate3 room1_ _roommate3 roommate1 roommate2 room1_
the intent send form letter each person in column 1 tell them names of roommates.
since can use distinct on row , not on field, @ temporary loss how might able this. able if worked is:
select (distinct column1), column2, column3
first instance of each column1. suggestions?
sounds group might useful?
Comments
Post a Comment