Click here to Skip to main content
15,307,395 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Table:
Model No int
Description varchar
Price int


now i want to show the models that have same price...I have tried with this
SQL
select distinct(Objpc1.Model),Objpc.Model  from pc Objpc1 , Pc Objpc
where Objpc.Price=Objpc1.Price and Objpc.Model!=Objpc1.Model



The output iam getting is
VB
1232    1233
1233    1232


but i need to show either of this as 1233 and 1232 or 1232 and 1233????
Posted

SQL
select Objpc1.Model,Objpc.Model  from pc Objpc1 INNER JOIN Pc Objpc
ON Objpc.Price=Objpc1.Price 
   
Comments
dharan1990 27-Jun-12 6:48am
   
hi thanks for ur reply ...this will also produce the same result ...
Kamalkant(kk) 27-Jun-12 6:59am
   
YOUR TABLE IS ONE I.E PC
SQL
select distinct(Objpc1.Model),Objpc.Model  from pc Objpc1 , Pc Objpc
where Objpc.Price=Objpc1.Price and Objpc.Model!=Objpc1.Model and Objpc.model<Objpc1.model
   

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