从表中获得不同的值 [英] Getting distinct values from table

查看:72
本文介绍了从表中获得不同的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

select A.*, B.ename,B.eid from gen_complaints as A inner JOIN equipment as B where A.eid=B.eid



这是我在投诉表中的查询,一个设备ID上有多个记录,我想在下拉框中显示这些设备ID,它正在工作,但显示重复的ID值可以帮助您从上述查询中获取不同的值吗? div class ="h2_lin">解决方案



我认为您正在获取多个实际上不需要的列.下拉框仅填充一列,即 b.eid 仅获取该列.

使用以下查询,这可能对您有帮助

select distinct B.eid from gen_complaints as A inner JOIN equipment as B where A.eid=B.eid


谢谢
--RA


将查询更改为

从gen_complaints中选择不同的B.eid,A.*,B.ename作为A的内部JOIN设备作为B,其中A.eid = B.eid

因为开斋节很独特,我想是这样
您将获得解决方案
没有什么不可能的


select A.*, B.ename,B.eid from gen_complaints as A inner JOIN equipment as B where A.eid=B.eid



This is my query in complaints table more than one records are there on one equipment id, i want to display those equipment ids in dropdown box, it is working but showing duplicate id values can you any one help to get distinct values from above query

解决方案

Hi,

I think you are fetching more than one column which is actually not required. Dropdown box will populate with only one column ie b.eid fetch that column only.

use the below query, this may helps you

select distinct B.eid from gen_complaints as A inner JOIN equipment as B where A.eid=B.eid


Thanks
--RA


change ur query as

select distinct B.eid, A.*, B.ename from gen_complaints as A inner JOIN equipment as B where A.eid=B.eid

because the Eid is unique i think so
you will get the solution
nothing is impossible


这篇关于从表中获得不同的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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