how to join this sql query

Posted by Gow.net under Sql Server on 1/27/2012 | Points: 10 | Views : 967 | Status : [Member] | Replies : 3
How to join dell and sony?

TableName1: dell

SELECT  a1.model,a1.rating, COUNT(a2.rate) ModelRank
FROM dellfeedback a1, dellfeedback a2
WHERE a1.commands like '%light%' and (a1.rating!='poor' and a1.rating!='Not Poor' and (a1.rate <= a2.rate or (a1.rate=a2.rate and a1.model = a2.model)))
GROUP BY a1.model, a1.rating
ORDER BY ModelRank DESC


TableName2: Sony

SELECT a1.model,a1.rating,  COUNT(a2.rate) Sales_Rank 
FROM Sonyfeedback a1, Sonyfeedback a2
WHERE a1.rating!='poor' and a1.rating!='Not Poor' and(a1.rate <= a2.rate or (a1.rate=a2.rate and a1.model = a2.model) )
GROUP BY a1.model, a1.rating
ORDER BY Sales_Rank DESC


any one tell me here attach my Source

gowthaman8870226416


Responses

Posted by: Blessyjees on: 1/31/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi,

Do you want to change each query with join?

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Gow.net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sksamantaray on: 1/31/2012 [Member] Silver | Points: 25

Up
0
Down


Use Union after first query

Thanks,
Sanjay

Gow.net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gow.net on: 1/31/2012 [Member] Starter | Points: 25

Up
0
Down
yes i need join that each query

gowthaman8870226416

Gow.net, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response