Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select distinct problem

Status
Not open for further replies.

pkirkley

Programmer
Sep 6, 2001
12
0
0
US
I am doing the following select statement against a view-

SELECT distinct(req_number), formatted_req_number, post_title, division3, division2, salary_grade, source_posting_date_end FROM posting where source_posting_date_begin <= '5-Feb-2003' order by division2, division3, post_title

In the DB there are 2 records with the same req_number. This distinct will work until I change the source_posting_date_end to a new value. Before the 2 records have the same information.

My Question:
Does the distinct only have operation on the req_number or the whole select statement? It appears to impact all cols being selected based on the results.

FYI - posting is a view that is joining multiple tables thus why there could be 2 or more records that are identical.
 
Yes - distinct works across all columns being selected.
 
Sometime I found that using GROUP BY clause provide me more flexibility over DISTINCT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top