Re: sql query single table



On Tue, 3 Oct 2006 07:56:03 -0700, madgame wrote:

Hugo,
Here are the inserts.
(snip)
The "Central Host" is the system whose agcprefix = DAC. Each "Central Host"
record should be a unique sysid. An offboard is considered a sysid which
does not have an agcprefix = DAC. An offboard always has a central host, but
a central host does not always have an offboard. Also he only wants the
release level from either type to be like 'DK%'.

Hi Madgame,

Finally found some time to play with your data - thanks for posting it.

You write that you only want to include rows with release level like
'DK%'. After applying that filter, I see only rows with agcprefix other
than DAC. That means that, if I understand your requirements correct,
there is no "Central Host"- only offboards. But you als write that an
offboard must "have" a central host - whatever "have" means in this
context. And you provide sample output that lists three central hosts
and one offboard. So I guess I DON'T understand the requirements
correctly. Could you try to clarify this a bit further?

(snip)
Totals:
Total Systems 4
Total offboards 1
Total Onboards 2
Total DK041B 2
Total DK061B 1
Total DK050 1
Total Platform1 1
Total Platform2 2
Total Platform3 1

It's almost certainly a better idea to calculate these totals in the
front-end. You'll have to pass over the output from the query row by row
anyway - while doing that, you can keep track of the various totals
listed here, then display them when the last row of the query has been
processed. Let me know if you really need to get this part from SQL as
well - but note that performance will probably suck.

Oh, and by the way - are you using SQL Server 2000 or 2005?

--
Hugo Kornelis, SQL Server MVP
.



Relevant Pages

  • sql query single table
    ... The requestor has specifics on the way it ... An offboard always has a central host, ... a central host does not always have an offboard. ... He also wants totals as specified ...
    (microsoft.public.sqlserver.mseq)
  • Re: sql query single table
    ... INSERT INTO [dsdasysconfigprofile] ... An offboard always has a central host, ... a central host does not always have an offboard. ... He also wants totals as specified ...
    (microsoft.public.sqlserver.mseq)
  • Re: sql query single table
    ... INSERT INTO [dsdasysconfigprofile] ... An offboard always has a central host, ... a central host does not always have an offboard. ... He also wants totals as specified ...
    (microsoft.public.sqlserver.mseq)