Click here to Skip to main content
15,888,454 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Posted
Updated 30-Jan-12 19:31pm
v2
Comments
Rajesh Anuhya 31-Jan-12 1:31am    
Code Tags Added
--RA
CRDave1988 31-Jan-12 1:32am    
Not Possible with this query.
CRDave1988 31-Jan-12 1:37am    
use only equipment table

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
 
Share this answer
 
Comments
janareddyjanareddy 31-Jan-12 1:42am    
Not working

this is the error

Error Code : 2006
MySQL server has gone away
(0 ms taken)
Rajesh Anuhya 31-Jan-12 1:44am    
Here is the Solution for the error
http://www.webyog.com/forums/index.php?showtopic=3227
--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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900