我有table-A
,我想从2016-06-25
和2016-06-26
中选择日期范围来查找名称的差异。
根据图片,结果应该是这样的:
2016-06-26 joe 40
我猜查询有点像这样:
SELECT * FROM `2g`
WHERE 'Date' between '2016-06-25' AND 'Date' '2016-06-26'
and (`name` != `name`)
答案 0 :(得分:0)
此where and ( name != name )
子句永远不会返回任何内容,因为name
始终等于name
。你应该做点什么:
SELECT * FROM 2g WHERE 'Date' between ('2016-06-25' AND '2016-06-26')
AND count(name) = 1
GROUP BY name
答案 1 :(得分:0)
请检查一下。我不知道这个语法适用于mysql。
SELECT name FROM 2g
WHERE 'Date' between '2016-06-25' AND '2016-06-26'
Group by Name
Having count(Name) > 1
答案 2 :(得分:0)