mysql - i have tow table which contain on same column like UserID. How to get all row by subquery -
i have tow table contain on same column userid
1. employee -------------------------------------------------------- id userid name description 1 username1 fullname1 employee description1 2 username2 fullname2 employee description2 -------------------------------------------------------- 2. user_info -------------------------------------------------------- id userid password 1 username1 password1 2 username2 password2 --------------------------------------------------------
i have user_info data. want employee table row according user_info data "subquery" want use subquery syntax
i don't know why want subquery, try this, maybe works;)
select e.* employee e exists ( select 1 user_info u e.userid = u.userid ) -- maybe conditions else need, can add
or can try this,
select e.* employee e e.userid in ( select u.useid user_info u )
anyway, perhaps other solution exists...
Comments
Post a Comment