select accountname
from asd t where not exists (select 1 from asd where find_in_set(t.accountname,parent) and housenum=t.housenum)
from asd t where not exists (select 1 from asd where find_in_set(t.accountname,parent) and housenum=t.housenum)
解决方案 »
- 使用Mysql C API 的预处理语句时出错
- MYSQL可不可以不在dos下通过脚本文件建表
- 问一个写sql语句的问题,和sql语句的返回值
- postgresql数据库 怎么写sql语句得到数据表中字段名称??
- 请问关于如何同时对两个数据库进行操作的问题????急噢...
- MySql开发SDK那边可以下载,Window和Linux版本,只需要开发程序库和头文件即可,谢谢
- 急,一个简单问题,如果更改MYSQL里表的字段属性,我想把 varchar(10)改为varchar(15)!在线等,谢谢。!
- SQL 语句优化
- MYSQL5.6启动错误Can't start server: Bind on TCP/IP port: No such file or directory
- mysql字符和整数类型转换异常
- 查询结果集可以作为表名
- Tomcat部署的网站连接不上MySQL
這段SQL是可以用的,可是目前碰到一個奇怪的問題。
由於我的 表asd其實是用left join把 member和replydb兩張表單連結起來的表單,那我目前下的sql如下SELECT `t`.`accountname`
FROM member AS t
LEFT JOIN replydb AS q ON `t`.`account` = `q`.`account` WHERE not exists (select 1 from member,replydb where find_in_set(t.accountname,parent)and housenum=t.housenum)然而再+了and housenum=t.housenum仍然跟沒有加這段sql的結果是一樣的,不知道事哪部份出了問題呢?account 和 housenum 都在member 表單裡面 parent則在 replydb裡資料的正確性有先檢查過應該是沒有問題@@
下圖則是
加入條件後但應該要抓出housenum 021的蘇裕翔,和019的周彥廷才對還有012的蘇惟楷
可是目前依然只能抓出012的蘇惟楷
select accountname
from VIEW t where not exists (select 1 from VIEW where find_in_set(t.accountname,parent) and housenum=t.housenum)
您好,使用view確實能夠正確的抓出我想要的資料。
感謝您的回答。不過想請問一下,為何無法直接透過LEFT JOIN抓出資料呢???