SQL Query to display count of two columns from different tables

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • padmaneha
    New Member
    • Sep 2008
    • 17

    SQL Query to display count of two columns from different tables

    Hi

    Thank you for your response. Query doesnt give the expected result.

    Here is the sample data :

    Foodid blogcid
    3 12356
    3 12357
    3 12358
    9 15265
    15 18963
    15 18964
    19 0
    13 22156

    Videoid Videotitle Destid

    9 paneerpakora 3
    10 paneerpakora 3
    11 aloogobhi 9
    16 chinese chickensalad 15
    17 chinese chickensalad 15
    18 chinese chickensalad 15
    45 Chicken 19
    0 tomato soup 13


    Here is the expected result:

    Output should display as given

    Food id blogcnt Videocnt
    3 3 2
    9 1 1
    15 2 3
    13 1 1

    On executing the query it should display only those records for which blogs and videos are existing. It should not dipslay the records if there are no videos or if there are no blogs posted. In other words it should fetch only those records for which videos and blogs are posted, displaying the count of blogs and count of videos as given above.
Working...