Showing posts with label brings. Show all posts
Showing posts with label brings. Show all posts

Sunday, March 25, 2012

Distinct Query

When i run this query,
select distinct(firstname + ' ' + lastname), firstname, lastname, department
from tbltest

it brings out 149 records

but when i run it with the extension field

select distinct(firstname + ' ' + lastname), firstname, lastname, department, extension
from tbltest

Is there like a limit to the distinct query on the number of columns returned ?first query

select distinct(firstname + ' ' + lastname), firstname, lastname, department
from tbltest

2nd query
select distinct(firstname + ' ' + lastname), firstname, lastname, department, extension
from tbltest

hi,

r u getting a different no of records when the 2nd query is executed?

if so, the fields SELECTed by the second query will not be DISTINCT (with extension added to the SELECT list)