I'm wanting to use the distinct function to parse duplicate records (in a stored procedure from ADO, but I don't think that is the issue). The problem is that it is not eliminiting the duplicate records??? The following is a sample of what I've tried to do. Some columns in the select and where clause as well as some joins have been removed, just to make it easier to read. Note that I'm pulling back columns of just about every data type in this select and also using several joins.
SELECT DISTINCT location.thursday_start_hours, merchant.merchant_desc, merchant.logo_small, savings.savings_id, savings.start_date, savings.end_date, savings.image_name, savings.short_desc, savings.long_desc, savings.regular_price, savings.sale_price, savings_type.savings_type_desc, mileage = 75
INNER JOIN location ON zip2.zip_code = location.zip
INNER JOIN merchant ON location.merchant_id = merchant.merchant_id
WHERE merchant.active_ind = 1
ORDER BY mileage, savings.savings_id
I read something on MSDN that suggested it may be the "order by" that is causing the problems? Any other ideas? What about the idea of comparing real numbers using a distinct? Would that keep the SQL server from thinking they are the same?
Thanks in advance for any help, mhenley.
SELECT DISTINCT location.thursday_start_hours, merchant.merchant_desc, merchant.logo_small, savings.savings_id, savings.start_date, savings.end_date, savings.image_name, savings.short_desc, savings.long_desc, savings.regular_price, savings.sale_price, savings_type.savings_type_desc, mileage = 75
INNER JOIN location ON zip2.zip_code = location.zip
INNER JOIN merchant ON location.merchant_id = merchant.merchant_id
WHERE merchant.active_ind = 1
ORDER BY mileage, savings.savings_id
I read something on MSDN that suggested it may be the "order by" that is causing the problems? Any other ideas? What about the idea of comparing real numbers using a distinct? Would that keep the SQL server from thinking they are the same?
Thanks in advance for any help, mhenley.