Max VS Inner Join Problem....this script will show all row in table X2. How to Break it ?
=============== =====
Id Name
=============== =====
1 a
2 b
3 c
Table X2
=============== =============== =============== ============
Id IdX1 Price Description
1 1 100 AA
2 1 200 BB
3 2 300 CC
4 2 400 DD
i want result Be :
Name Max_Price Description
=============== =============== =============== ======
a 200 BB
b 400 DD
BEFORE i use :
select x1.name, max(x2.Max_Pric e) as maxprice, x2.description from x1 INNER JOIN x2 on x1.id=x2.idX1 group by name,descriptio n order by Name ASC; but this script will show all row in table X2. How to Break it ?
=============== =====
Id Name
=============== =====
1 a
2 b
3 c
Table X2
=============== =============== =============== ============
Id IdX1 Price Description
1 1 100 AA
2 1 200 BB
3 2 300 CC
4 2 400 DD
i want result Be :
Name Max_Price Description
=============== =============== =============== ======
a 200 BB
b 400 DD
BEFORE i use :
select x1.name, max(x2.Max_Pric e) as maxprice, x2.description from x1 INNER JOIN x2 on x1.id=x2.idX1 group by name,descriptio n order by Name ASC; but this script will show all row in table X2. How to Break it ?
Comment