Pael,

Try this:

SELECT firmal.beskrivelse as Businessline, lokasjon.navn as Location,
count(person.[uniqueid])
FROM firmal INNER JOIN (
person INNER JOIN lokasjon
ON person.lokid = lokasjon.lokid)
ON firmal.firmalid = person.firmalid
GROUP BY firmal.beskrivelse, lokasjon.navn

Replace [uniqueid] with the primary key of the person table.

Andy
> -----Original Message-----
> From: Paal Eriksen [mailto:[EMAIL PROTECTED]
> Sent: 11 November 2003 12:11
> To: [EMAIL PROTECTED]
> Subject: SQL query question
>
>
> Hi, i have the following query:
>
> SELECT person.name as Name, firmal.beskrivelse as Businessline,
> lokasjon.navn as Location
> FROM
> firmal INNER JOIN (
> person INNER JOIN lokasjon
> ON person.lokid = lokasjon.lokid)
> ON firmal.firmalid = person.firmalid
>
> which will give me a list of Name, Businessline, Location. What
> i'm trying to do is to get a list which is grouped on
> Businessline and Location. Then i want to list a count of name at
> each location and businessline. How can i achieve this, if it's possible?
> So it should be like this:
>
> Businessline, Location, Sum people
> A                  AA           10
> A                  AB           30
> B                  AA           5
> B                  AB           27
> B                  AC           90
>
> Paal
>
> Ny versjon av Yahoo! Messenger
> Nye ikoner og bakgrunner, webkamera med superkvalitet og dobbelt
> så morsom



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to