+ Reply Thread
#1

Hi, I have these tables in my database

client

client_id

name

phone_number

property

property_id

name

location

client_id

surveyor_id

surveyor

surveyor_id

name

username

password

tenant

tenant_id

name

property_id

SELECT c.client_id, c.name, count(p.property_id) as total_property FROM client AS c INNER JOIN property AS p ON p.client_id = c.client_id WHERE p.surveyor_id='5'

With the above query, I hope to get the numbers of properties each CLIENT has. if possible the numbers of tenants in each property.

My result is the total numbers of properties the Surveyor is managing









#2

You will need to give us some small SQL codes to assist with testing this o.

#3

the sql code is highlighted red on the thread.

SELECT c.client_id, c.name, count(p.property_id) as total_property FROM client AS c INNER JOIN property AS p ON p.client_id = c.client_id WHERE p.surveyor_id='5'


dhtml wrote:

You will need to give us some small SQL codes to assist with testing this o.


Back to top