🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: bit.listserv.sqlinfo
Article #247

Re: cOUNT(*) PROBLEM

#247
From: Mike MacKinnon
Date: Tue, 10 Oct 2000 00:00
90 lines
4045 bytes
Hi! I guess in relation to what is written below boils down to, 'Is it
possible to put a criteria, i.e. >=20, on a 'Count(*)'?

Hope someone can help,

Mike

Mike MacKinnon <MMacKinnon@pgpower.com> wrote in message
news:3zgE5.5442$44.17216@news.iol.ie...
> Good morning! I hope someone can help me on this.
>
> I have written a bit of code (see below) that extracts data from a
database.
> The problem is that I am getting the wrong count. The count returned is
the
> amount of lines in the specified position in the DB and not the amount of
> lines that are >=20.
>
> Can anyone see where I'm going wrong on the code?
>
>
> Thanks
>
> Mike
>
>
> SELECT "Stock file Co 01"."Book Code", "Stock file Co 01"."Allocated
stock",
> "Stock file Co 01"."Stock Code", Count(*)
> FROM "Batch/Serial Header file Co 01" "Batch/Serial Header file Co 01",
> "Stock file Co 01" "Stock file Co 01"
> WHERE "Batch/Serial Header file Co 01"."Stock Code" = "Stock file Co
> 01"."Stock Code" AND (("Stock file Co 01".Supplier='16') AND ("Stock file
Co
> 01"."Discontinued Item"='N') OR ("Stock file Co 01".Supplier='52') AND
> ("Stock file Co 01"."Discontinued Item"='N') OR ("Stock file Co
> 01".Supplier='71') AND ("Stock file Co 01"."Discontinued Item"='N') OR
> ("Stock file Co 01".Supplier='34') AND ("Stock file Co 01"."Discontinued
> Item"='N') OR ("Stock file Co 01".Supplier='28') AND ("Stock file Co
> 01"."Discontinued Item"='N') OR ("Stock file Co 01".Supplier='61') AND
> ("Stock file Co 01"."Discontinued Item"='N') OR ("Stock file Co
> 01".Supplier='2') AND ("Stock file Co 01"."Discontinued Item"='N') OR
> ("Stock file Co 01".Supplier='35') AND ("Stock file Co 01"."Discontinued
> Item"='N') OR ("Stock file Co 01".Supplier='410') AND ("Stock file Co
> 01"."Discontinued Item"='N') OR ("Stock file Co 01".Supplier='168') AND
> ("Stock file Co 01"."Discontinued Item"='N') OR ("Stock file Co
> 01".Supplier='59') AND ("Stock file Co 01"."Discontinued Item"='N') OR
> ("Stock file Co 01".Supplier='75') AND ("Stock file Co 01"."Discontinued
> Item"='N') OR ("Stock file Co 01".Supplier='86') AND ("Stock file Co
> 01"."Discontinued Item"='N'))
> GROUP BY "Stock file Co 01"."Allocated stock", "Stock file Co 01"."Stock
> Code"
> HAVING ("Stock file Co 01"."Allocated stock">=20) OR ("Stock file Co
> 01"."Allocated stock">=20) OR ("Stock file Co 01"."Allocated stock">=20)
OR
> ("Stock file Co 01"."Allocated stock">=20) OR ("Stock file Co
01"."Allocated
> stock">=20) OR ("Stock file Co 01"."Allocated stock">=20) OR ("Stock file
Co
> 01"."Allocated stock">=20) OR ("Stock file Co 01"."Allocated stock">=20)
OR
> ("Stock file Co 01"."Allocated stock">=20) OR ("Stock file Co
01"."Allocated
> stock">=20) OR ("Stock file Co 01"."Allocated stock">=20) OR ("Stock file
Co
> 01"."Allocated stock">=20) OR ("Stock file Co 01"."Allocated stock">=20)
> ORDER BY "Stock file Co 01"."Book Code", "Stock file Co 01"."Stock Code"
>
>
>
>
> --
>
>
>
> Mike MacKinnon
> Systems Administrator
> PG Power Distribution Ltd
> Ballymount Road
> Dublin 12
> Rep. of Ireland
>
> Tel          01-450-5553
> Mobile    087-284-9756
> *********************************************************
> The worse the haircut, the slower it grows out....
>
> *********************************************************
>
>
Technical Details
Message-ID: <9wAE5.5546$44.17811@news.iol.ie>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3zgE5.5442$44.17216@news.iol.ie>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11355a,5ae13aaad616362e
X-Google-Attributes: gid11355a,public
From: "Mike MacKinnon" <MMacKinnon@pgpower.com>
Subject: Re: cOUNT(*) PROBLEM
Date: 2000/10/10
Message-ID: <9wAE5.5546$44.17811@news.iol.ie>
X-Deja-AN: 679642341
References: <3zgE5.5442$44.17216@news.iol.ie>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
X-Complaints-To: abuse@iol.ie
X-Trace: news.iol.ie 971166853 193.203.144.247 (Tue, 10 Oct 2000 09:34:13 BST)
Organization: Ireland On-Line Customer
X-MSMail-Priority: Normal
NNTP-Posting-Date: Tue, 10 Oct 2000 09:34:13 BST
Newsgroups: bit.listserv.sqlinfo