Unix C++
Would you like to react to this message? Create an account in a few clicks or log in to continue.

what does count(*)>2 mean?>?

3 posters

Go down

what does count(*)>2 mean?>? Empty what does count(*)>2 mean?>?

Post by mightyganesh Fri Mar 19, 2010 6:42 pm

SELECT ITEM#,SUM(QTY) FROM ORD_ITEMS GROUP BY ITEM#
HAVING COUNT(*)>2;

what does this count(*)>2 mean?>?
mightyganesh
mightyganesh

Posts : 53
Points : 92
Join date : 2010-02-26
Age : 35

http://ganeshguna.blogspot.com

Back to top Go down

what does count(*)>2 mean?>? Empty Re: what does count(*)>2 mean?>?

Post by mightyganesh Fri Mar 19, 2010 6:46 pm

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
mightyganesh
mightyganesh

Posts : 53
Points : 92
Join date : 2010-02-26
Age : 35

http://ganeshguna.blogspot.com

Back to top Go down

what does count(*)>2 mean?>? Empty Re: what does count(*)>2 mean?>?

Post by parwani_ravi Fri Mar 19, 2010 6:49 pm

@mightyganesh

it returns the items which occur more than twice

parwani_ravi

Posts : 4
Points : 55
Join date : 2010-03-09
Age : 36
Location : Haldia

Back to top Go down

what does count(*)>2 mean?>? Empty Re: what does count(*)>2 mean?>?

Post by mightyganesh Fri Mar 19, 2010 6:52 pm

YA I ALSO THOUGHT THE SAME
HW2 also appears twice in the table! so it must also be displayed! but it is not! Sad
mightyganesh
mightyganesh

Posts : 53
Points : 92
Join date : 2010-02-26
Age : 35

http://ganeshguna.blogspot.com

Back to top Go down

what does count(*)>2 mean?>? Empty Re: what does count(*)>2 mean?>?

Post by Christopher Fri Mar 19, 2010 7:00 pm

the condition is "count(*)>2". HW2 appears only twice, it fails the condition. tatsy not displayed.
Christopher
Christopher
Admin

Posts : 240
Points : 429
Join date : 2010-02-26
Age : 35

https://unixcpp.forumotion.com

Back to top Go down

what does count(*)>2 mean?>? Empty Re: what does count(*)>2 mean?>?

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum