Skip to content
Advertisement

how can i fetch the name from id by using this query?

there are 2 table tbl_hk and tbl_hk_work:

  1. tbl_hk:hk_id(pk), hk_name

  2. tbl_hk_work:hk_work_id, hk_id(fk), hk_work_date, hk_work_1bed, hk_work_2bed, hk_work_time

and I have written a query to fetch sum of hk_work_1bed, hk_work_2bed from hk_id from two dates inputted by the user and I also want to fetch hk_name with the same query but its showing error the only help I need is everything is perfect I just want hk_name to be fetched with the SUM.

QUERY:

Advertisement

Answer

all you need is to join your tbl_hk table and group by hk_name

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement