Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Databases General > Re: "code" tabl...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 4 Topic 3202 of 3295
Post > Topic >>

Re: "code" tables?

by "Roy Hann" <specially@[EMAIL PROTECTED] > Jun 27, 2008 at 01:59 PM

"Ed Prochak" <edprochak@[EMAIL PROTECTED]
> wrote in message 
news:4b1507c9-207e-4555-bd27-42dd0e84de9d@[EMAIL PROTECTED]
> On Jun 26, 12:31 pm, "David Cressey" <cresse...@[EMAIL PROTECTED]
> wrote:

> When I see
> SELECT DISTINCT
> in anything but an ad hoc query, I know something is wrong with the
> query.

Eh?!  How can you possibly "know"any such thing?  Projecting away 
distingui****ng columns is perfectly respectable, desirable and necessary. 
And since SQL won't discrard the resulting duplicates automatically
(unless, 
bizarrely, it is in a UNION) we need to tell it to do so explicitly.

> Possibly it is joining to a wrong table (to a detail table
> instead of a header/parent table for example) or some filtering
> condition is missed (a column not in the select list needs to be
> used), or some join condition was missed (there is a compound key and
> one component was left out).  Even in an ad hoc query I tend to use
> SELECT COUNT(*)
> since that gives me a little bit more information for the same cost as
> DISTINCT (i.e. it reads the same amount of data).
>
> Seeing this post, I'm actually a little disappointed in you, David.
> Your last sentence does show you mainly follow a good approach. It's
> just that DISTINCT should be left to ad hoc queries IMO.

This is not a matter to be decided on the basis of mere opinion.

Roy
 




 4 Posts in Topic:
Re: "code" tables?
Ed Prochak <edprochak@  2008-06-27 05:23:20 
Re: "code" tables?
"Roy Hann" <  2008-06-27 13:59:14 
Re: "code" tables?
Gene Wirchenko <genew@  2008-06-27 09:56:23 
Re: "code" tables?
"David Cressey"  2008-06-30 11:33:42 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 9:22:44 CST 2008.