我的目标是从存在大量重复值的“EmbedImgDimension”列中选择值。
我使用了以下查询
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”列中选择唯一值。我们将不胜感激任何帮助。
谢谢。
最佳答案
select
distinct concat(embedimgwidth,' x ',embedimgheight) as EmbedImgDimension
from embedimages
inner join Video on Video.schoolid=#Value#
where embedimages.isdeleted=0 order by embedimages.embedimgwidth asc;
更新
说您还想要不同的视频 ID 是一个合乎逻辑的问题。你想得到每个维度只出现一次的结果,对吗?那么,您如何期望获得所有不同的 videoID 结果呢?想象你有
videoid dimension
1 1x1
2 1x1
3 2x2
4 2x2
也许你可以告诉我你想要得到哪个结果。 但是你要么得到 1x1 和 2x2,要么得到 1、2、3、4——当你想要维度唯一性时,你不能同时得到所有不同的视频标识符,明白我的意思吗?
关于Mysql:如何从数据库列中选择不同的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3413542/