Select isnull (Select Sum (1) from T wherere achievement> a grade), 0) 1 AS 'name, * from t aorder by grade DESC
1,
SELECT *, ISNULL (Select Sum (1) from T1 WHERE Publish> a. Published), 0) 1 AS Name from T1 Aorder BY (SELECT SUM (1) from T1 WHERE Piece> = a. )
ID Name total score --------------------------------------- 1 jksfff 270 15 sfjskj 270 13 skfjsk 249 34 sfjskj 249 32 loskfi 238 5
(The number of rows affects is 5 lines)
2,
Select *, ISNULL (Select Count (Distinct Publish) from T1 WHERE REF> a. Rooms), 0) 1 AS Name from T1 Aorder BY (Select Sum (1) from T1 WHEREE Radio> = A. General points)
ID Name total score --------------------------------------- 1 jksfff 270 15 sfjskj 270 13 Skfjsk 249 24 sfjskj 249 22 loskfi 238 3
(The number of rows affects is 5 lines)
Note: Oracle Isnull Replace with NVL