我只想在 sqlite 中获得非重复行
I want to get only NON-duplicate row in sqlite
我有 table:
+-------+-------+------+----------+
| Name | Price | Url | Adress |
+-------+-------+------+----------+
| John | Smith | blah | London 1 |
+-------+-------+------+----------+
| John | Smith | blah | London 1 |
+-------+-------+------+----------+
| Jenny | Cole | blah | Prague 1 |
+-------+-------+------+----------+
我想得到这个:
+-------+------+------+----------+
| Jenny | Cole | blah | Prague 1 |
+-------+------+------+----------+
我试图用 having 创建 sqlite 命令,但没有结果..
Select * From your_table_name
Group By Name, Price, Url, Adress
Having Count(*) = 1;
我想你想要这样的东西:
select Name, Price, Url, Adress
from table t
group by Name, Price, Url, Adress
having count(*) = 1;
;WITH C AS(
SELECT 'John' AS Name , 'Smith' AS Price , 'blah' AS URL , 'London 1' AS Address
UNION ALL
SELECT 'John' AS Name , 'Smith' AS Price , 'blah' AS URL , 'London 1' AS Address
UNION ALL
SELECT 'Jenny','Cole' ,'blah' ,'Prague 1'
UNION ALL
SELECT 'Jenny','Cole' ,'blah' ,'Prague 2'
UNION ALL
SELECT 'Jenny','Cole' ,'blah' ,'Prague 3'
)
SELECT Name, Price, URL, Address
FROM C
GROUP BY Name, Price, URL, Address
HAVING COUNT(*) = 1;
我有 table:
+-------+-------+------+----------+
| Name | Price | Url | Adress |
+-------+-------+------+----------+
| John | Smith | blah | London 1 |
+-------+-------+------+----------+
| John | Smith | blah | London 1 |
+-------+-------+------+----------+
| Jenny | Cole | blah | Prague 1 |
+-------+-------+------+----------+
我想得到这个:
+-------+------+------+----------+
| Jenny | Cole | blah | Prague 1 |
+-------+------+------+----------+
我试图用 having 创建 sqlite 命令,但没有结果..
Select * From your_table_name
Group By Name, Price, Url, Adress
Having Count(*) = 1;
我想你想要这样的东西:
select Name, Price, Url, Adress
from table t
group by Name, Price, Url, Adress
having count(*) = 1;
;WITH C AS(
SELECT 'John' AS Name , 'Smith' AS Price , 'blah' AS URL , 'London 1' AS Address
UNION ALL
SELECT 'John' AS Name , 'Smith' AS Price , 'blah' AS URL , 'London 1' AS Address
UNION ALL
SELECT 'Jenny','Cole' ,'blah' ,'Prague 1'
UNION ALL
SELECT 'Jenny','Cole' ,'blah' ,'Prague 2'
UNION ALL
SELECT 'Jenny','Cole' ,'blah' ,'Prague 3'
)
SELECT Name, Price, URL, Address
FROM C
GROUP BY Name, Price, URL, Address
HAVING COUNT(*) = 1;