php - SQL select items from one table with conditions from another -
i have 2 tables:
accounts(id, name, adress, type) holidays(name, startdate, enddate)
and type column accounts set("manager","director","administrator")
example.
the name column both colums relationed. when creates holiday, name table holidays name account logged in.
and want know if it's possible make sql statement can take of table 2 the table1.type need "director" , table1.name needs on holidays.
select * accounts a, holidays h a.name = h.name , a.type = 'director'
this should entries want. it's important link a.name
h.name
ensure right combination.
Comments
Post a Comment