I have a my sql DB and using php to access it.

My tables look like:

> 
> Flights Table Flight ID, Time, Airport
> 
> 
> 

Seats Table
Flight ID, Seat Number

I have the following query:

```
SELECT f.FlightID 'ID', Count(*) 'Seats Booked' FROM flights f, seats s  GROUP BY f.FlightID

```

I want the out put to be

> 
> Flight ID Seats Booked
> 
> 
> ID Num seats book
> 
> 
> 

The problem is currently it shows this:

```
[{"ID":"0","Seats Booked":"37"},{"ID":"1234","Seats Booked":"37"}] (The output is JSON encoded)

```

When it should be be like 10 and 27 if you follow me? It doesnt seem to be the join correctly.

Please give an explanation of what im doing wrong rather than just an answer.

Thanks!