what does count(*)>2 mean?>?
3 posters
Unix C++ :: UNIX CPP :: RDBMS & ORACLE
Page 1 of 1
what does count(*)>2 mean?>?
SELECT ITEM#,SUM(QTY) FROM ORD_ITEMS GROUP BY ITEM#
HAVING COUNT(*)>2;
what does this count(*)>2 mean?>?
HAVING COUNT(*)>2;
what does this count(*)>2 mean?>?
Re: what does count(*)>2 mean?>?
SELECT * FROM ORD_ITEMS ;
ORD# ITEM# QTY
101 HW1 100
101 HW3 50
101 SW1 150
101 SW1 150
102 HW2 10
103 HW3 50
104 HW2 25
104 HW3 100
105 SW1 100
9 rows selected.
SELECT ITEM#,SUM(QTY) FROM ORD_ITEMS GROUP BY ITEM#
HAVING COUNT(*)>2;
ITEM# SUM(QTY)
HW3 200
SW1 400
ORD# ITEM# QTY
101 HW1 100
101 HW3 50
101 SW1 150
101 SW1 150
102 HW2 10
103 HW3 50
104 HW2 25
104 HW3 100
105 SW1 100
9 rows selected.
SELECT ITEM#,SUM(QTY) FROM ORD_ITEMS GROUP BY ITEM#
HAVING COUNT(*)>2;
ITEM# SUM(QTY)
HW3 200
SW1 400
Re: what does count(*)>2 mean?>?
@mightyganesh
it returns the items which occur more than twice
it returns the items which occur more than twice
parwani_ravi- Posts : 4
Points : 55
Join date : 2010-03-09
Age : 36
Location : Haldia
Re: what does count(*)>2 mean?>?
YA I ALSO THOUGHT THE SAME
HW2 also appears twice in the table! so it must also be displayed! but it is not!
HW2 also appears twice in the table! so it must also be displayed! but it is not!
Re: what does count(*)>2 mean?>?
the condition is "count(*)>2". HW2 appears only twice, it fails the condition. tatsy not displayed.
Unix C++ :: UNIX CPP :: RDBMS & ORACLE
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|