欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

mysql 相同某一列的值相同

shiping1 的头像

查找 相同firstorder的值相同的数据 (我只取出id,firstorder)

SELECT id , firstorder
FROM dede_archives AS a
WHERE a.firstorder
IN (
SELECT firstorder
FROM dede_archives b
WHERE b.id != a.id
) order by firstorder

 

 

 

SELECT id,typeid,firstorder
FROM dede_archives AS a
WHERE a.firstorder
IN (
SELECT firstorder
FROM dede_archives b
WHERE b.id != a.id and a.typeid=b.typeid
) order by firstorder;

普通分类: