Find the employees in a department having maximum number of emps ?

Dear All ,
how to get the employees in a department having maximum number of employees using only one select clause in whole query
i don't need more than one select statement in whole query.
Thanks
Damby

910346 wrote:
Dear All ,
how to get the employees in a department having maximum number of employees using only one select clause in whole query
Looks like a home work.. What have you tried so far?
i don't need more than one select statement in whole query.Is there any specific reason for this?
One possibility is to create a function to get the department id with maximum number of employees. Then use this function to filter out your data..

Similar Messages

  • Need to find out department having maximum total salary among all depts

    Hi,
    I am new to oracle. I was wondering how would I create a query for following condition.
    I have a employee table. There are columns like emp_id, emp_name, emp_dept, emp_sal
    I need to find out department having maximum total salary among all departments .......
    This was asked in one of the interviews.............
    Thanks in davance,
    Abhijit
    Edited by: 833515 on Feb 3, 2011 4:11 AM

    Hi,
    You can use aggregate functions, analytic functions etc. Read up aggregate functions from the docs and try to write the query yourself. If you face any problems, post it in the forums.
    Happy learning!!
    Regards,
    Sujoy

  • HR-ABAP.How to Find the Employees assigned to the Appraisal Template

    Hi ,
    Please help me out.how to find the employees assigned to the Appraisal template.
    Ex. 7825232 is a appraisal template id and i want to know in the system how many employees assigned to it..
    Please let me know if the post is missing something.
    Suggestion also appreciated ...
    Thanks Inadvance!
    Law.

    check this fm HRHAP_DOCUMENT_GET_LIST_XXL
    Thanks
    Bala Duvvuri

  • Find the Employees for whom Manager is not available

    Hi
    I wish to find all the Find the Employees for whom Manager is not available?
    Can anyone Pls throw some light how I can?
    Regards,
    Sreeram

    Hi
    Get all the Positions without "A002 - Reports" Relationship from table HRP1001 (excluding A002 from input screen).
    After finding the positions, get ee no.s for those positions from table PA0001.
    Hope this helps.
    Best Regards
    Reddy

  • Finding the employees whose have the max salary

    i am working with a table called employee with the following fields (empno,ename,sal....), i want to find the employee/s which have the max salary i wrote the followinng sql statment
    select * from employee where sal = ( select max(sal) from employee)
    it works well but i am wondering if there is a more effient way to do this
    please note that the table have about i million row, and there is an index on empno field

    if there is a more effient way to do this
    You can see execution plan using different queries:
    SQL> set autotrace trace explain statistics
    SQL> select * from
      2  (select e.*, dense_rank() over(order by sal desc) x
      3  from emp e)  where x=1;
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=5 Card=14 Bytes=1400          )
       1    0   VIEW (Cost=5 Card=14 Bytes=1400)
       2    1     WINDOW (SORT PUSHED RANK) (Cost=5 Card=14 Bytes=448)
       3    2       TABLE ACCESS (FULL) OF 'EMP' (Cost=1 Card=14 Bytes=448          )
    Statistics
              0  recursive calls
              2  db block gets
              1  consistent gets
              0  physical reads
              0  redo size
            864  bytes sent via SQL*Net to client
            503  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
              1  rows processedMessage was edited by:
    Jameel

  • Finding the next smaller and next larger prime number

    Hey all, will this code help me find the next larger and next smaller prime number? I only ask because my main() isnt outputting anything, but everything looks fine there. So assuming I may have done something that didnt make sense here.
              //returns the next larger prime number
              long largerGetter = num;
              long lG = num + 1;
              while(largerGetter != 1)
                   largerGetter = PrimeChecker.primeOrNot(lG);
                   lG++;
              nextLargerPrimeNumber = lG;
              //returns next smaller prime
              long smallerGetter = num;
              long sG = num - 1;
              while(smallerGetter != 1)
                   smallerGetter = PrimeChecker.primeOrNot(sG);
                   sG--;
              nextSmallerPrimeNumber = sG;

    JimmyV88 wrote:
    Hey all, will this code help me find the next larger and next smaller prime number? ...If this isn't homework (which it probably is), use the BigInteger class to find a [next probable prime|http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigInteger.html#nextProbablePrime()] given a prime number or keep subtracting two from that given prime and check if that number is [(probable) prime|http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigInteger.html#isProbablePrime(int)] to find the previous prime.

  • How can i find the location of my ipod by serial number

    how can i find the location of my ipod by serial number. Someone stole my ipod touch and I cant find it. I have the serial number.

    No, the SN will only help identify the iPod as yours IF it is recovered
    - If you previously turned on FIndMyiPod on the iPod in Settings>iCloud and wifi is on and connected go to iCloud: Find My iPhone, sign in and go to FIndMyiPhone. If the iPod has been restored it will never show up.
    iCloud: Find My iPhone
    - You can also wipe/erase the iPod and have the iPod play a sound via iCloud.
    and go to FIndMyiPhone. If the iPod has been restored it will never show up.
    iCloud: Find My iPhone
    - You can also wipe/erase the iPod and have the iPod play a sound via iCloud.
    - If not shown, then you will have to use the old fashioned way, like if you lost a wallet or purse.
    - Change the passwords for all accounts used on the iPod and report to police
    - There is no way to prevent someone from restoring the iPod (it erases it) using it unless you had iOS 7 on the device. With iOS 7, one has to enter the Apple ID and password to restore the device.
    - Apple will do nothing without a court order                                                        
    Reporting a lost or stolen Apple product                                               
    - iOS: How to find the serial number, IMEI, MEID, CDN, and ICCID number

  • How to find the compoment version information given a PPMS number?

    Hi,
    <b>Problem</b>:
    I want to find the component version information with a PPMS number; and would like to know how to.
    (I don't know which forum is exactly proper to post this thread, and then put it in NetWeaver Platform category.)
    <b>Details</b>:
    In ERP system, transaction BOPP (PPMS work center), you can find product/component (version) information, including their PPMS number.
    While I didn't find the way to retrieve the component version and other information, given a PPMS number.
    Is this possible in BOPP? Or there is other ways to do this?
    Thanks and regards,
    Said

    user651567 wrote:
    Hi,
    Through putty we can access the unix server which is the Databse server.So i need the ip and port number to connect.Why don't you just walk down the hall and ask your friendly SA? Or if he's not in the same building, pick up the phone.
    I'm increasingly aware of a sub-culture that is afraid or unwilling to actually talk to their co-workers to find out information that is unique to their organization ....

  • Query to find the list of BP without having Particular GL transactions.

    Hi Experts,
    I want the query to find the List of Business partner who is not having Journal entry for Certain General ledger.
    Scenario: we are creating JE for TDS posting.
    so, i want to know the list of BP , who and all not having particular TDS GL for the particular period.
    Thanks in advance,
    Dwarak

    Hi Dwarak,
    Sure, no problem
    DECLARE @AcctCode AS NVARCHAR(100)
    SELECT @AcctCode=T0.AcctCode FROM OACT T0 WHERE T0.AcctCode='[%0]'
    DECLARE @DateFrom AS DATETIME
    SELECT @DateFrom=T1.RefDate FROM JDT1 T1 WHERE T1.RefDate=[%1]
    DECLARE @DateTo AS DATETIME
    SELECT @DateTo=T2.RefDate FROM JDT1 T2 WHERE T2.RefDate=[%2]
    SELECT CardCode FROM OCRD WHERE CardType='S'
    AND CardCode NOT IN(
    SELECT DISTINCT ContraAct FROM JDT1
    WHERE Account=@AcctCode AND RefDate BETWEEN @DateFrom AND @DateTo)
    Ok, now, here's the problem that I just encountered. This query will work, but, no matter how we fill the parameter, it will show you the very same result. To be honest, I don't know what's wrong with this query.
    If you change all the variables ( @AcctCode and @DateFrom and @DateTo ) directly, it will give you the accurate result. Take this as an example:
    SELECT CardCode FROM OCRD WHERE CardType='S'
    AND CardCode NOT IN(
    SELECT DISTINCT ContraAct FROM JDT1
    WHERE Account='10030201' AND RefDate BETWEEN '2011-09-01' AND '2011-09-20')
    I hard-code the account code, date from and date to for selection. System will show you the accurate result, but using parameter as in first query, system show same result no matter how we fill the parameter.
    Sorry, it seems that I could only partially solved your problem here. I already tried to create a stored procedure and executing the stored procedure with parameter, but still, somehow SBO show very same result no matter if we change the parameter.
    So, my solution need user to manually change the parameter in query. I know, this is a stupid solution, I'm afraid I can't help you to achieve perfect solution here. Maybe anyone here in the forum could guide me to fix my mistake in first query and how to rectify it?
    Best Regards,
    Hendry Wijaya

  • How to find the Employee Supervisor name

    Hi,
    Could any body please help me to find out the employee supervisor name oracle hrms?
    Regards
    sami.

    The above query from Ashish is fine for a quick one-off query, but for any production-quality code you should always surround SYSDATE with the TRUNC function when comparing to Effective Start and End Dates. The reason for this is SYSDATE includes a Time component; however, the DateTrack APIs ensure that the Effective Start and End Date columns do not, ie: they have a Time component of *00:00:00* (midnight). If you don't use the TRUNC function you can potentially miss records in your query whose Effective End Date is on the same day as SYSDATE, as the time component of SYSDATE will be after midnight.
    For example:
    Assignment ID = 123
    Effective Start Date = 01-Jan-2012 00:00:00
    Effective End Date = 18-May-2012 00:00:00
    WHERE SYSDATE BETWEEN asg.effective_start_date AND asg.effective_end_date
    At this moment SYSDATE = 18-May-2012 09:41:22
    ...which is after the Assignment's Effective End Date, even though in reality the record should have been included in the result set.
    Barry Goodsell

  • BAPI to find the Employee Emergency address..

    Hi All,
    I have tried using the BAPI 'BAPI_ADDRESSEMP_GETDETAIL' to get the employee emergency contact address. It gives me the error stating '0009No data stored in the selected period'. I can see the data for the employee in PA20 for the same period.
    Can you please let me know if there is any other ways to get this details or how to correct the Error..
    Regards,
    Vidya.

    I used the BAPI 'BAPI_ADDRESSEMPGETDETAILEDLIST' as I was trying to get the emergency contact details..
    Regards,
    Vidya.

  • K mean:: how to find the clustred data;:: or how to assign number t0 each group of data

    hi member
    i have download the LabVIEW Machine Learning Toolkit https://decibel.ni.com/content/docs/DOC-19328
    i want to excute the K mean algorithem to cluster the image in two group or three or more
    the problem is how to find the result i mean the clustred image', the image that contain 2 or three intesity value only
    or how to aasign a 1 vlaue to all intesity that 
    belong to cluster one and 255 to data that belong to cluster 2
    so that the image look like binary image???
    a my vi below
    best regards
    Solved!
    Go to Solution.
    Attachments:
    k mean.vi ‏12 KB

    my post before showed how to set the threshold manually using the graph's cursor.
    here's the automated k-means version, using the toolkit's .vi
    Alex
    ♜♖ LabView 8.6 - LabView 2014 ♖♜
    Attachments:
    2013-06-22_2dhistogram 2009.zip ‏61 KB

  • How to find the premise GUID to a given premise number in CRM

    Hi Guys,
    I try to find the PremiseGUID (VerbrSt.GUID) to a given Premise Number (Verbrauchsstellen-Nr. in German), either in  IS-U (6.0) or in CRM (2007).
    I need it as a foreign key in CRM table ISU_POD to connect the PoD with the Premise (field is named u201CFF0047u201D or u201CVerbrSt.GUIDu201D  in table ISU_POD).
    I think it should be a 22 dec. alphanum. field, corresponding to the 10 dec. num. field of the premise number.
    Any suggestions in which table(s) I can find the PremiseGUID?
    Thank you very much.
    Christian

    Hi Anji,
                The view VIAUF_AFVC  is for maintenance orders and operations. I tried giving my functional location on the selection screen and checked for the contents , but it says no entries found. Probably this table will get populated only when a maintenance order is issued.
       I need to find out the equipments at a given functional location . Is there any other way ?
    regards,
    Venkatesh.

  • How to find the LoginNames which are only having the special chars %, @, .

    I have a table called LoginTable in that I have a column called LoginName
    I want to select only the LoginNames which are having the special charecters like %, @ and . how to write the query
    Please help me out.
    it is some thing like select LoginName from LoginTable where LoginName like (%, @, .) please correct my query

    Please use regexp_like, if your database is Oracle10g 10.1 or higher.
    Otherwise...
    how to search for '%' in data
    select * from LoginTable
    where
    LoginName like '%\%%' escape '\'
    or
    LoginName like '%@%'
    or
    LoginName like '%.%'
    ;

  • T-SQL for finding the unused tables which are consuming maximum disk space.

    Hi,
    Need help in writing a T-SQL that can return me the unused or least used tables in a database and are consuming a lot of disk space.
    Thanks  

    Refer
    http://gallery.technet.microsoft.com/SQL-List-All-Tables-Space-baf0bbf9
    create table #TableSize (
    Name varchar(255),
    [rows] int,
    reserved varchar(255),
    data varchar(255),
    index_size varchar(255),
    unused varchar(255))
    create table #ConvertedSizes (
    Name varchar(255),
    [rows] int,
    reservedKb int,
    dataKb int,
    reservedIndexSize int,
    reservedUnused int)
    EXEC sp_MSforeachtable @command1="insert into #TableSize
    EXEC sp_spaceused '?'"
    insert into #ConvertedSizes (Name, [rows], reservedKb, dataKb, reservedIndexSize, reservedUnused)
    select name, [rows],
    SUBSTRING(reserved, 0, LEN(reserved)-2),
    SUBSTRING(data, 0, LEN(data)-2),
    SUBSTRING(index_size, 0, LEN(index_size)-2),
    SUBSTRING(unused, 0, LEN(unused)-2)
    from #TableSize
    select * from #ConvertedSizes
    order by reservedKb desc
    drop table #TableSize
    drop table #ConvertedSizes
    --Prashanth

Maybe you are looking for