Feb 2, 2005 #1 brownfox Programmer Jan 5, 2003 173 GB I only want to return one row for driver_guide 46 but "select distinct driver_guide,driver_make..." returns both records: Code: [u]driver_guide| driver_make[/u] 46 |Jaguar 46 |Ford Any help much appreciated.
I only want to return one row for driver_guide 46 but "select distinct driver_guide,driver_make..." returns both records: Code: [u]driver_guide| driver_make[/u] 46 |Jaguar 46 |Ford Any help much appreciated.
Feb 2, 2005 #2 r937 Technical User Jun 30, 2002 8,847 CA of course the function of DISTINCT is to ensure that all result rows are unique you have two columns in the SELECT therefore you get only distinct combinations of those two values in the example you show, those rows are unique rudy | r937.com | Ask the Expert | Premium SQL Articles SQL for Database-Driven Web Sites (next course starts March 6 2005) Upvote 0 Downvote
of course the function of DISTINCT is to ensure that all result rows are unique you have two columns in the SELECT therefore you get only distinct combinations of those two values in the example you show, those rows are unique rudy | r937.com | Ask the Expert | Premium SQL Articles SQL for Database-Driven Web Sites (next course starts March 6 2005)
Feb 2, 2005 Thread starter #3 brownfox Programmer Jan 5, 2003 173 GB OK I get that but how do I just get just one row? Do I have to join the table on itself using an alias or something? Upvote 0 Downvote
OK I get that but how do I just get just one row? Do I have to join the table on itself using an alias or something?
Feb 2, 2005 #4 ericbrunson Technical User Jan 9, 2004 2,092 US No, just "select distinct driver_guide". Upvote 0 Downvote
Feb 2, 2005 1 #5 hoinz MIS Jan 29, 2004 944 DE ... get just one row? but which one? You could use group by and aggregate functions, something like this: Code: select driver_guide, min(driver_make) from your_table group by driver_guide; hope this helps Upvote 0 Downvote
... get just one row? but which one? You could use group by and aggregate functions, something like this: Code: select driver_guide, min(driver_make) from your_table group by driver_guide; hope this helps