This had been asked multiple times, but I am not finding a solution that works for me. I have a view similar to below. I need to run a query that returns all of the columns, but only once for any unique GLASS_ID. I also need a where clause WHERE GLASS_ID LIKE ‘%’ + @PartialGlassId + ‘%’
VEH_ID GLASS_ID OPENING_SEQ PART_NUM PREFIX_CD ANT_FLAG BLK_SIZE1 26975 DB00201 1 201 DB Y 14.00 26864 DB00375 1 375 DB N 16.00 26865 DB00375 1 375 DB N 16.00 26866 DB00375 1 375 DB N 16.00 38929 DB00408 1 408 DB N 12.00 38930 DB00408 1 408 DB N 12.00 38931 DB00408 1 408 DB N 12.00 38932 DB00408 1 408 DB N 12.00 38933 DB00408 1 408 DB N 12.00 38990 DB00408 1 408 DB N 12.00 38991 DW01015 1 1015 DB N 12.00
The results should be
VEH_ID NAGS_GLASS_ID OPENING_SEQ PART_NUM PREFIX_CD ANT_FLAG BLK_SIZE1
26975 DB00201 1 201 DB Y 14.00
26864 DB00375 1 375 DB N 16.00
38929 DB00408 1 408 DB N 12.00
for WHERE GLASS_ID LIKE ‘%DB00%’
NOTE : the WHERE clause, in this case, could be in the subquery from the INNER JOIN also.