I have a dynamically generated sql query that is generated in VB6 and then passed on to SQL Server 2005. The query joins(inner join, left join, etc.) multiple tables.
If I were to execute that query in Sql Server Management Studio, I would get something like this:
TrayID| TrayID | EVA_ID
212 | 212 | NULL
313 | 313 | NULL
852 | 852 | 456-89
759 | 759 | 654-22
The duplication for the field i.e. 'TrayID' is by intention.
**How to fetch the distinct 'EVA_ID'? **
My initial idea was to insert these into a temporary (ex. #TempTable) table and then select distinct for 'EVA_ID'. But this fails because there is a duplicate 'TrayID'