我有两个MySQL表的MySQL从表中获取数据,如果有另一个表中的值
myTabs
- ID
- 用户代码
- tab_id
- FID
- tablistid
标签
- tab_id
- 标题
- 用户代码
- ACCESS_TYPE
- 问题
两个表都tab_id作为主密钥,并使用相同的值。我想列出mytabs表中的数据,它在tabs表和access_type = 1中具有相同的tab_id。我不想列出来自Tabs的记录,查询应该只从Tabs验证,如果该Tab有access_type 1,那么它应该列出
这可能吗?我正在尝试的是它没有返回任何东西。
$mysql = "select mytabs.*, tabs.* FROM mytabs, tabs where mytabs.usercode='$usercode' and (mytabs.fid IS NULL || mytabs.fid='0') and tabs.access_type = '1' order by mytabs.tablistid asc"