select
(select count(meepos) from mae where maepos = 1) as pos1count,
(select count(maepos) from mae where maepos = 2) as pos2count
...

or better yet,

select maepos, count(maepos) as poscount
from mae group by maepos
order by maepos

This will return 2 columns and multiple rows - the first column
contains the position and the second column contains the number of
items in that position. Which will be easier and more change friendly
than the alternative single-row query above.

hth

> Is there an easy/simple way to combine these four queries
> into one?
> I'm not thinking clearly today. :(

> SELECT COUNT (MAEPOS) AS Pos1Count
> FROM MAE
> WHERE MAEPOS = 1

> SELECT COUNT (MAEPOS) AS Pos2Count
> FROM MAE
> WHERE MAEPOS = 2

> SELECT COUNT (MAEPOS) AS Pos3Count
> FROM MAE
> WHERE MAEPOS = 3

> SELECT COUNT (MAEPOS) AS Pos4Count
> FROM MAE
> WHERE MAEPOS = 4

> Thanks Che

s. isaac dealey   954.927.5117

new epoch : isn't it time for a change?

add features without fixtures with
the onTap open source framework
http://www.sys-con.com/story/?storyid=44477&DE=1
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to