[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: SQL Count Statement
Hello Susannah:
You have to watch out with those count statements - dont ever try to mix
them with anything else or you will get unpredictable results. Keep it as
simple as possible.
So, your example below would not work as expected due to the 'order by'
clause.
Begin-SQL
Select count (emplid) from ps_employees
where empl_status in ('A','L')
order by paygroup
End-SQL
But this might work.
let #count = 0
begin-select
count (emplid) &count_emplid
move &count_emplid to #count
from ps_employees
where empl_status in ('A','L')
end-select
(Embedded
image moved susannah_wells @ PAGENET.COM
to file: 10/10/97 06:33 AM
PIC26764.PCX)
Please respond to SQR-USERS@USA.NET
To: SQR-USERS @ list.iex.net
cc: (bcc: Steve Hall)
Subject: SQL Count Statement
Can you include an SQL count statement in your SQR without having any
other columns being selected?
Begin-SQL
Select count (emplid) from ps_employees
where empl_status in ('A','L')
order by paygroup
End-SQL
Susannah Wells
Software Engineer
Paging Network, Inc.
Work 972-985-6352
VoiceNow 972-330-3898
Pager 214-835-9638, Dallas Pin 0 005-3565
Internet susannah_wells@pagenet.com
PIC26764.PCX