473,320 Members | 1,868 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

count the no of emp under GPM list that emp with mgrid

Hi

MY table contains

empid empname mgrid mgrname Department


1 suneetha 2 Rama MTS
2 Rama 5 Venkat PM
3 Kiran NULL NULL GPM
4 Hema 2 Rama NULL
5 Venkat 3 Kiran SPM
NULL NULL NULL NULL MTS



i want to find number of employees under GPM

count the number of emp under GPM list that emp with mgrid


Thank you
Mar 13 '08 #1
2 930
srinit
43
Can you tell me your requirement clearly..and post the code what you tried

cheers..//
Mar 13 '08 #2
deepuv04
227 Expert 100+
Try the following
Expand|Select|Wrap|Line Numbers
  1. with cte as
  2. (
  3.     select empid, empname, mgrid, mgrname ,Department
  4.     from Table_Name where empid = (select distinct empid from Table_Name where department= 'GPM' ) 
  5.     union all
  6.     select O.empid, O.empname, O.mgrid, O.mgrname, O.Department
  7.     from Table_Name O, Cte C WHERE O.mgrid   = C.empid 
  8. )
  9. SELECT COUNT(empid) FROM CTE
  10.  
  11.  
Mar 13 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Bart Nessux | last post by:
New to Python... trying to figure out how to count the objects in a list and then map the count to the objects or convert the list to a dict... I think the latter would be better as I need a number...
22
by: Ling Lee | last post by:
Hi all. I'm trying to write a program that: 1) Ask me what file I want to count number of lines in, and then counts the lines and writes the answear out. 2) I made the first part like this: ...
3
by: jason | last post by:
Hello. I've got this simple collection populate code I downloaded from the net (sorry can't find source now) I'm trying to test, but I can't seem to get it to work. Any help would be greatly...
11
by: Farel | last post by:
Which is Faster in Python and Why? jc = {}; m = x = ,,.......] # upwards of 10000 entries def mcountb(): for item in x: b = item; b.sort(); bc = 0 for bitem in b: bc += int(bitem) try: m...
2
by: GoCoogs | last post by:
I'm trying to count how many items are in a dynamic collection. This is the code I have so far. *** Begin Code *** Public Class Rule Private _rulevars As RuleVarsCollection Private _rulename...
2
by: bearophileHUGS | last post by:
itertools.count docs say: Does not currently support python long integers. Note, count() does not check for overflow and will return negative numbers after exceeding sys.maxint. This behavior may...
3
by: Auddog | last post by:
I have the following query that works in mysql: select id, order_no, price, count(item_no), sum(price) from production WHERE item_no = '27714' group by item_no; When I setup my query in php,...
26
by: Ping | last post by:
Hi, I'm wondering if it is useful to extend the count() method of a list to accept a callable object? What it does should be quite intuitive: count the number of items that the callable returns...
4
by: =?Utf-8?B?a2s=?= | last post by:
Personally I do not like the "sophisticated" code but, anyway I have this (I squeez it to save a space): using System; using System.Collections.Generic; public class SamplesArray { public...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.