这是我正在使用的mysql查询。如何使用Like运算符在Mysql中显示重复值?
SELECT distinct Emprego.title as title, Emprego.up as up, Emprego.datetime as datetime, Emprego.content as content, Category.name as category_name, Emprego.states as states, Emprego.id as id, User.nome as nome, Emprego.email as email FROM City, User , Category, Emprego, Type
where
Emprego.category_id=Category.id and Emprego.City_id=City.id and Emprego.type_id=Type.id and Type.id='$type'
and (Emprego.title LIKE '%$text%') or (Emprego.content like '%$text%') and Emprego.User_id= User.id
order by datetime DESC
我正在使用此查询获取重复行。
如何解决?
这是结果:
[
{
"title": "Cozinheiro Madeira",
"up": "1",
"datetime": "2017-09-05 23:41:48",
"content": "Cozinheiro na \nMadeira",
"category_name": "Telecomunicações",
"states": "2",
"id": "12",
"nome": "admin",
"email": "[email protected]"
},
{
"title": "Cozinheiro Madeira",
"up": "1",
"datetime": "2017-09-05 23:41:48",
"content": "Cozinheiro na \r\nMadeira",
"category_name": "Telecomunicações",
"states": "2",
"id": "16",
"nome": "admin",
"email": "[email protected]"
}
]
你*没有*获取重复的行,因为你有'选择不同'。请编辑您的问题并显示您所得到的结果。我们可以解释他们为什么不是duplciates。 –
@GordonLinoff查看结果,看看是否没有“重复”大声笑....我看到重复... –
你没有重复。 “ID”列在每行不同 – nzjoel