不包含唯一列的SQL查询

时间:2019-03-07 00:07:28

标签: mysql sql database

因此,我尝试查询仅具有某些匹配属性的行,例如:

cond1=df1.EmailAddress.isin(df2.Email)
cond2=df1.DateTimeCreated.ge(datetime.today() - timedelta(90))#change df2 here to df1

我想要的结果是除以下以外的所有行:

review_pages=requests.get("https://www.tripadvisor.com/Hotel_Review-g60745-d94367-Reviews-Harborside_Inn-Boston_Massachusetts.html")  
soup3=BeautifulSoup(review_pages.text,'html.parser')   
value=soup3.find_all(class_='hotels-review-list-parts-AdditionalRatings__bubbleRating--2WcwT')    
Value_1=soup3.find_all(class_="hotels-review-list-parts-AdditionalRatings__ratings--3MtoD")

5 个答案:

答案 0 :(得分:0)

SELECT * FROM mytable WHERE NOT memID=5

答案 1 :(得分:0)

这是您想要的吗?

SELECT memID, name, SSN
FROM yourTable
WHERE memID IN (SELECT memID FROM yourTable GROUP BY memID HAVING COUNT(*) > 1);

答案 2 :(得分:0)

我认为您想要所有列都是唯一的行-它们在其他行中不存在。我想到exists

select t.*
from t
where not exists (select 1
                  from t t2
                  where t2.memid = t.memid or
                        t2.name = t.name or
                        t2.ssn = t.ssn
                 );

如果您希望其中一列或任何一列重复的行,则需要exists而不是not exists

答案 3 :(得分:0)

请尝试这个。

SELECT Distinct memID, name, SSN
FROM tableName
WHERE memID IN (SELECT memID FROM tableName GROUP BY memID HAVING COUNT(*) > 1);

答案 4 :(得分:0)

您可以使用以下查询:

select * from Tablename 
where memid in(select memID from Tablename group by memID having count(*)>1)