Re: Group By and duplicate records problem
From: Girish (gbajaj_at_tietronixinc.com)
Date: 08/06/04
- Next message: Grant Case: "Restrict use of Multiple Users for the Same Login"
- Previous message: Pat Paulson: "recompile SP and distributed transaction"
- In reply to: Joe Celko: "Re: Group By and duplicate records problem"
- Next in thread: Joe Celko: "Re: Group By and duplicate records problem"
- Reply: Joe Celko: "Re: Group By and duplicate records problem"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 5 Aug 2004 23:30:37 -0500
i meant equal to one. :-D
Sometime ones brain thinks of something and then writes something else.
I have two copies of your book btw... one my friend has borrowed (for a year
now) and ones at work. :)
Thanks for the tips!
Girish
"Joe Celko" <jcelko212@earthlink.net> wrote in message
news:uWvLtV1eEHA.248@TK2MSFTNGP12.phx.gbl...
> >> We inherited this database schema.. so have to work on it without
> changes :( <<
>
> Horror stories seem to begin with (1)"Let's go up to that old castle and
> ask Count Dracula for help.." (2) "We have venture capitalists
> interested in us" or (3)"We inherited this database schema".
>
> Seriously, you can inherit a schema that so bad it has to be changed.
> Do not dismiss this action. I get called into disasters where database
> design errors can kill people. I did not consider killing people to be
> a better choice than a re-design of a database or some data scrubbing.
>
> In your case, synonyms are relatively easy -- use a temp table to update
> them to a standard code and then add a CHECK() constraint or a
> REFERENCES clause to prevent the errors in the future.
>
> If you have problems with the office politics, just "Gee, if you are
> *sure* that this will pass a Sarbanes-Oxley audit and that you and your
> boss will not go to a federal prison for it, just sign this disclaimer
> so the Feds will know that I gave you warning."
>
> >> ... and using your query, i believe, would take out records [sic]
> such as the one pointed out below in the following table data example:
> <<
>
> Yes; they appear once and not multiple times. Only 'R-1111' and 'R-4444'
> appear more than once.
>
> >> I believe using HAVING COUNT(*) > 1 will remove R-2222 and R-3333
> because the count for that group is less than one. Anyway this can be
> done? <<
>
> Unh?? A group has to have (COUNT(*) >= 1) or there is no group; and a
> COUNT() cannot be a negative number. What am I missing?
>
> --CELKO--
> ===========================
> Please post DDL, so that people do not have to guess what the keys,
> constraints, Declarative Referential Integrity, datatypes, etc. in your
> schema are.
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!
- Next message: Grant Case: "Restrict use of Multiple Users for the Same Login"
- Previous message: Pat Paulson: "recompile SP and distributed transaction"
- In reply to: Joe Celko: "Re: Group By and duplicate records problem"
- Next in thread: Joe Celko: "Re: Group By and duplicate records problem"
- Reply: Joe Celko: "Re: Group By and duplicate records problem"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|