if you have a windows box that you can use as a 
front end, download corereader from 
http://www.corereader.com   it lets you do point 
and click queries, so you can quickly experiment 
with simple queries.  


> In article <[EMAIL PROTECTED]>,
> [EMAIL PROTECTED] writes:
> 
> > Hi,
> > Does version 2.23.52 supports the use of nested select?
> 
> > I want to write a query based on a group where I do a count of something for
> > each group. In SQL Server 7 it would look something like this,
> 
> > select 
> > a.department
> > ,(select count(*) from empdb where gender='m' and department=a.department)
> > as male
> > ,(select count(*) from empdb where gender='f' and department=a.department)
> > as female
> 
> > from empdb a
> > group by department
> 
> No need for a nested SELECT:
> 
> SELECT department,
>        SUM(IF(gender = 'm', 1, 0)) AS male,
>        SUM(IF(gender = 'f', 1, 0)) AS female
> FROM empdb
> GROUP BY department
> 



-- 
        John Ragan
        [EMAIL PROTECTED]
        http://www.CoreReader.com/ 


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to