solunatec
asked on
need to create output from more than one table using join
Need to create output from more than one table using join and wildcards..on the sql call
the sql statement works on the first table but cannot figure out the join...the third table
populates the emp_code_type of the second table.; at least thats the plan.
first table:accounts table:
account_id
account_name
physical_address
city
stat_prov
country
zip
second table:employees_table
account_uid
active_site_uid
emp_uid
emp_code_type
emp_name
emp_address
emp_city
emp_frequency
emp_hours_of_cleaning
third table:emps_code_type
emp_type_uid
emp_type_description
right now it working ok for the information for the first table but not sure how to join to the
second table.... attached is the two php files which do the calls...
clientspecs.php
results3.php
the sql statement works on the first table but cannot figure out the join...the third table
populates the emp_code_type of the second table.; at least thats the plan.
first table:accounts table:
account_id
account_name
physical_address
city
stat_prov
country
zip
second table:employees_table
account_uid
active_site_uid
emp_uid
emp_code_type
emp_name
emp_address
emp_city
emp_frequency
emp_hours_of_cleaning
third table:emps_code_type
emp_type_uid
emp_type_description
right now it working ok for the information for the first table but not sure how to join to the
second table.... attached is the two php files which do the calls...
clientspecs.php
results3.php
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SELECT * FROM accounts
INNER JOIN employees_table ON account_id = account_uid
INNER JOIN emps_code_type ON emp_code_type = emp_type_uid
I'm not sure if I have picked the correct JOIN fields. Change them if not. Also I am assuming that there is always a record in all three tables. If there can be a record missing in some tables then use LEFT JOIN rather than INNER JOIN