我的目標是從存在大量重複值的「EmbedImgDimension」列中選擇值。Mysql:如何從數據庫列中選擇不同的值
我用下面的查詢
select
distinct EmbedImgId,
VideoID,
EmbedImgHeight,
EmbedImgWidth,
EmbedImgFileName,
concat(embedimgwidth,' x ',embedimgheight) as EmbedImgDimension
from embedimages
inner join Video on Video.schoolid=#Value#
where embedimages.isdeleted=0 order by embedimages.embedimgwidth asc;
笏修改應該怎麼做在此查詢,以便從「EmbedImgDimension」 column.Any幫助將十分讚賞選擇唯一值。
謝謝。
如果你想獲得不同的值,你必須刪除非獨特的值(如video_ids)。你現在的方式,數據庫試圖找到video_id,EmbedImgId等獨特的組合(這可能是獨特的,所以你不會得到任何分組) – Nicolas78 2010-08-05 09:57:14
@ nicolas78:謝謝朋友......但我也需要實施 選擇 不同EmbedImgId, VideoID的, EmbedImgHeight, EmbedImgWidth, EmbedImgFileName我的查詢......所以笏可以做... – GethuJohn 2010-08-05 10:02:27
檢查我的更新。我認爲你想在邏輯上不可能,但也許你可以進一步詳細說明 – Nicolas78 2010-08-05 10:07:19