get th count from table and details from another table

Alarees Samer

I have two tables one contain the next

___________________________________
||         Hospital Table        || 
||_______________________________||
|| Hospital_no  || Hospital_name ||
||                               ||

and the other

___________________________________
||     Doctor Table              ||
||_______________________________||
|| Doctor_no    || Hospital_no   ||
||                               ||

which doctor.Hospital_no linked with Hospital.Hospital_no and i wont to get

______________________________________________________
|| Hospital_name | number of doctors in the hospital
||                                                  ||

how can i do that

Ganesh_Devlekar

try this:

select HP.Hospital_name,COUNT(DT.Doctor_no) as
NoOfDoctors
 from HospitalTable HP
Left join DoctorTable DT
ON HP.Hospital_no=DT.Doctor_no
GROUP BY HP.Hospital_name

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Display the details from one table and count from another table

From Dev

Get count from another table

From Dev

Count Row from another table

From Dev

Filter by count from another table

From Dev

Trying to use subquery to get row count from another table

From Dev

Count from another table in FROM subquery

From Dev

Select from one table and count from another

From Dev

MYSQL select from table and count from another

From Dev

Sql Query to get details from second table

From Dev

How to get count of two fields from two different table with grouping a field from another table in mysql

From Dev

How to get count of two fields from two different table with grouping a field from another table in mysql

From Dev

Selecting records from a table and then selecting a count of records from another table

From Dev

How to count rows from another table to affect another table

From Dev

Join a columns count from another table

From Dev

SQL query with count() from another table

From Dev

Adding a count from another table to existing query

From Dev

How use count for value from another table

From Dev

SQLite select and count from another table with like

From Dev

MySQL - Join & Count rows from another table

From Dev

How to count data from another table

From Dev

sql - show count of field from another table

From Dev

Select * as well as count/sum from another table

From Dev

SQL COUNT Rows from another table

From Dev

Get data from one table by reference of another table's column's count(*)

From Dev

mysql - count from different table supplemented with another count from subresult

From Dev

get the row details of other table from another server and merge it to your query

From Dev

Retrieving failed jobs from a table with retry details (id and retry count)

From Dev

selecting records from main table and count of each row in another table

From Dev

insert count from another table onto master table

Related Related

  1. 1

    Display the details from one table and count from another table

  2. 2

    Get count from another table

  3. 3

    Count Row from another table

  4. 4

    Filter by count from another table

  5. 5

    Trying to use subquery to get row count from another table

  6. 6

    Count from another table in FROM subquery

  7. 7

    Select from one table and count from another

  8. 8

    MYSQL select from table and count from another

  9. 9

    Sql Query to get details from second table

  10. 10

    How to get count of two fields from two different table with grouping a field from another table in mysql

  11. 11

    How to get count of two fields from two different table with grouping a field from another table in mysql

  12. 12

    Selecting records from a table and then selecting a count of records from another table

  13. 13

    How to count rows from another table to affect another table

  14. 14

    Join a columns count from another table

  15. 15

    SQL query with count() from another table

  16. 16

    Adding a count from another table to existing query

  17. 17

    How use count for value from another table

  18. 18

    SQLite select and count from another table with like

  19. 19

    MySQL - Join & Count rows from another table

  20. 20

    How to count data from another table

  21. 21

    sql - show count of field from another table

  22. 22

    Select * as well as count/sum from another table

  23. 23

    SQL COUNT Rows from another table

  24. 24

    Get data from one table by reference of another table's column's count(*)

  25. 25

    mysql - count from different table supplemented with another count from subresult

  26. 26

    get the row details of other table from another server and merge it to your query

  27. 27

    Retrieving failed jobs from a table with retry details (id and retry count)

  28. 28

    selecting records from main table and count of each row in another table

  29. 29

    insert count from another table onto master table

HotTag

Archive