与多个领域截然不同 [英] distinct with multiple field

查看:92
本文介绍了与多个领域截然不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的$ cStr ="选择不同的艺术家,公司来自albuminfo" ;;



我正在使用此查询来选择独特的艺术家和公司。但重复项也会显示出来。


有任何想法。


谢谢

my $cStr="select distinct artist,company from albuminfo ";


i am using this query to select unique artist and company. But the duplicates also get display.

Is any idea.

Thanks

推荐答案

cStr =" select alb artist,company from albuminfo" ;;


i使用此查询选择独特的艺术家和公司。但是副本也会显示出来。


有什么想法。


谢谢
cStr="select distinct artist,company from albuminfo ";


i am using this query to select unique artist and company. But the duplicates also get display.

Is any idea.

Thanks


选择不同的艺术家,albuminfo公司

你的mysql代码意味着将有独特的艺术家和公司不是独特的艺术家和独特的公司。

例如:

艺术家--------公司

------------------------------ ----------

艺术家A ------公司B

艺术家A -----公司C

艺术家A -------公司D

艺术家B -------公司A

艺术家C -------公司A


首先试试这个:

从albuminfo中选择不同的艺术家

以便你可以检查它是否真的有效。

如果它有效,问题可能在于您放置命令的方式
select distinct artist, company from albuminfo
your mysql code up there means that there will be distinct artist and company not distinct artist and distinct company.
For example:
Artist--------Company
----------------------------------------
Artist A------Company B
Artist A---- - Company C
Artist A-------Company D
Artist B-------Company A
Artist C-------Company A

Try this first:
select distinct artist from albuminfo
so that you can check whether distinct really works.
If it works, the problem might be in the way you put the command


感谢您的回复,


我试图只选择独特的艺术家,它的工作。但如果我选择艺术家和公司给出了重复的记录。


有任何想法。
Thanks for your reply,

I have tried to select only the distinct artist,its working.but if i select both artist and company it gives duplicate records.

is any idea.


这篇关于与多个领域截然不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆