SQL中查詢某幾個字段完全一樣的資料

2022-09-21 16:12:10 字數 445 閱讀 4797

有以下乙個表

movestar(id,name,title,ad程式設計客棧dress),內容為

現在要查詢所有具有相同的title和address的人

複製** **如下:

select star1.name,star2.name,star1.title,star1.address

from movestar as star1,movestar as star2

where star1.title = star2.title

and star1.address = star2.address

and star1.n程式設計客棧ame < star2.name;

結果:要點:使用了則會將內容重複列出

本文標題: sql中查詢某幾個字段完全一樣的資料

本文位址: /shujuku/mssql/153054.html

HQL查詢中取個別幾個字段

資料表 要求 查詢type為4001,以content分組,本計算不重複的pcinfoid mysql語句 select count distinct pcinfoid as count,content,time from vrv paw reportlog where type 4001 grou...

如何查詢乙個表中除某幾個欄位外其他所有的字段

大部分都是建議乙個乙個寫 當然程式設計師是最懶的啦,乙個乙個寫多痛苦啊 接著找還別說csdn裡還有不少大牛的 於是出現了這個指令碼 declare s nvarchar 1000 select s isnull s quotename name from syscolumns where id ob...

SQL刪除重覆記錄(針對於某幾個字段相同)

例 表中有條六條記錄。其中張三和王五 的記錄有重複 tablea id customer phoneno 001 張三 777777 002 李四 444444 003 王五 555555 004 張三 777777 005 張三 777777 006 王五 555555 如何寫乙個sql語句將ta...