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!

SQL Help: How to select distinct rows using the WHERE clause

Status
Not open for further replies.

Sethington

Technical User
May 16, 2006
34
US
I have an app at work that will only allow me to customize the WHERE clause on a SQL statement.

Currently the SQL Statement is hard coded something like this:

SELECT * FROM ERRORS

Is there a way to do a DISTINCT in the WHERE clause that would return the same results as:

SELECT DISTINCT MEMBER_NUMBER FROM ERRORS
 
highly unlikely. If your application only allows you to change the "where" part of the SQL, then this also means, as far as I can see that it will not allow you to select the tables you want, neither the joining tables. If this is the case, then change application, as it will be a very badly designed one.

What is the application anyway?

Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Clearly the app allows you to fetch just a subset of the entire table (probably for performance sake)

The distinct clause is by nature always applied as the last action on a returned set, cause it requires sorting of the final set.

Ties Blom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top