Welcome Guest, Not a member yet? Register   Sign In
build query for 2 different table
#1

(This post was last modified: 10-04-2021, 04:13 PM by includebeer. Edit Reason: formatting )

i have 2 table, profiles and details. 

trackid in details table is a foreign key that references to trackid in profiles table which is a primary key 
Code:
profiles table:
trackid| department |
---+----------+-----+
1      | IT         |
2      | Marketing  | 
3      | Sales      | 

details table:

ID | trackid | department    | employee
---+----------+---------+---------
1  | 1       | IT            | Ruben 
2  | 2       | Marketing     | Diaz
3  | 3       | Sales         | John
4  | 1       | IT            | Lucy
5  | 3       | Sales         | Anna

first i have list all of department from profiles table, then i put detail button to show detail from each department.
so when it clicked, it will redirect to the details page of clicked department and show number of employee and its name from details table.

is there any suggestion to build query in models for this case?
thank you
Reply


Messages In This Thread
build query for 2 different table - by zhikri - 09-30-2021, 08:46 PM



Theme © iAndrew 2016 - Forum software by © MyBB