This might get you onto a path (right or wrong... :-) )
SELECT odldat, count(*) FROM mylib.objstuff GROUP BY ODldat
union
SELECT 999999, count(*) FROM mylib.objstuff
order by 1
Change COUNT ( * )
Date
10,512 1
12,313 2
21,113 1
22,013 6
22,213 127
22,813 1
31,313 1
.
.
.
80,113 1
81,413 2
82,012 2
82,313 2
83,013 3
83,113 1
91,712 1
92,712 1
92,812 2
100,212 1
999,999 210
Steve Needles
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of fbocch2595@xxxxxxx
Sent: Monday, September 09, 2013 10:47 AM
To: midrange-l@xxxxxxxxxxxx
Subject: Re: SQL question
Hi Buck, that statement gave me;
Token , was not valid. Valid tokens: < > = <> <= !< !> != >= ¬< ¬> ¬
SELECT odobnm, odldat, odltim FROM myfile
where odldat = 090713 or odldat, 0 as total = 090813
union
select 'TOTAL', 9999999, 0, count(*) as total from myfile
where odldat = 090713 or odldat = 090813
order by 2
SELECT odobnm, odldat, odltim FROM myfile here odldat = 090713 or odldat, 0 as total = 090813 nion elect 'TOTAL', 9999999, 0, count(*) as total from myfile here odldat = 090713 or odldat = 090813 rder by 2
-----Original Message-----
From: Buck Calabro <kc2hiz@xxxxxxxxx>
To: midrange-l <midrange-l@xxxxxxxxxxxx>
Sent: Mon, Sep 9, 2013 11:41 am
Subject: Re: SQL question
On 9/9/2013 9:23 AM, Frank wrote:
Hi Folks, when I use the following statement I get a list of files but now I ant to know the count or total of the odobnm's in the query...what's the syntax or that or how can I get that number within by adding to the select statement?
Thanks, Frank
SELECT odobnm, odldat, odltim FROM myfile
where odldat = 090713 or odldat = 090813
order by odldat
Hi Frank,
ELECT isn't really like Query. SELECT wants to create a table. That
eans it wants all the columns to mean the same thing. The first column
s the object name, the second column is the change date, the third
olumn is the change time. With this file layout, which column would
old the count?
There is a way to coerce SELECT into combining two tables into one -
NION. UNION wants to combine two identically formatted tables into
ne. That means we need to add a column to hold the total. In the
etail table, we can use 0 as a place holder column in the SELECT. In
he total table, we need place holders for all the other columns.
inally, because we want the total to sort at the end, we can put a
arge value in the column that's being sorted. When the UNION combines
he detail and total tables, the ORDER BY will sort the large-value
otal at the end.
SELECT odobnm, odldat, odltim FROM myfile
here odldat = 090713 or odldat, 0 as total = 090813
nion
elect 'TOTAL', 9999999, 0, count(*) as total from myfile
here odldat = 090713 or odldat = 090813
rder by 2
--buck
-
his is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
o post a message email: MIDRANGE-L@xxxxxxxxxxxx
o subscribe, unsubscribe, or change list options,
isit:
http://lists.midrange.com/mailman/listinfo/midrange-l
r email: MIDRANGE-L-request@xxxxxxxxxxxx
efore posting, please take a moment to review the archives
t
http://archive.midrange.com/midrange-l.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/midrange-l.
________________________________
This communication, including attachments, is confidential, may be subject to legal privileges, and is intended for the sole use of the addressee. Any use, duplication, disclosure or dissemination of this communication, other than by the addressee, is prohibited. If you have received this communication in error, please notify the sender immediately and delete or destroy this communication and all copies.
TRVDiscDefault::1201
As an Amazon Associate we earn from qualifying purchases.