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.
 
As an Amazon Associate we earn from qualifying purchases.