Query to find 18 yrs Children

Hi All,
Can anybody tell me, how to write a Query to find the persons date of birth less than or equal to 18 yrs till today ?
Thanks in advance.

Something else like this ?
SQL> select * from mytable;
USERNAME                       CREATED
SYS                            13/11/05
SYSTEM                         12/11/05
OUTLN                          11/11/05
DBSNMP                         10/11/05
PS                             09/11/05
H89UCBAC                       08/11/05
PEOPLE                         07/11/05
TOTO                           09/11/06
8 rows selected.
--Take the users created in the last year.
SQL> select *
  2  from   mytable
  3  where created>=add_months(sysdate,1*-12)
  4  /
USERNAME                       CREATED
TOTO                           09/11/06
SQL> Nicolas.

Similar Messages

  • Query to find parent & al children customer based on child Party_number

    Hi All,
    I am working analyzing some TCA hierarchy data for a new customer dimension table design for a project and also for better understanding of the TCA.
    I need a query which can help me in listing all the PARTY IDs of all the customers that come under the top most rolled up customer which is found based on an any random input CHILD PARTY NUMBER.
    In simple terms.
    1. I have any random PARTY NUMBER of any customer in HZ PARTY.
    2. Using that PARTY NUMBER I need to find it's top most level rolled up parent customer.(i.e. Which global parent customer it falls under)
    3. Now based on the global customer found in the second step, I need to find all the customers (and all its global subsidiaries) under that one global name.(All the customers which are spread across the glob)
    I am currently using the following tables to build the logic.
    hz_parties
    hz_relationships
    hz_hierarchy_nodes
    fnd_lookup_values
    Anybody who has done such an exercise or has any kind of inputs, queries which can help, etc.. it would be really helpful.
    Thanks a lot.
    Thank you,
    Warm Regards
    Goldi

    hi goldie,
    u can use
    party_id (pk) from hz_parties,
    party_id(fk) and cust_account_id(pk) from hz_cust_accounts,
    cust_account_id(fk) from AR.HZ_CUST_ACCT_RELATE_ALL.
    i hope u can get the way for your answer..
    pls let me know, it worked or not.
    Regards.
    Pushpal

  • Recursive query for finding parents and children against two tables

    Hi I have two tables where the data is stored hierarchially.
    I have found using connect_by, level and other oracle functions doing its job when the data is in one table.
    Can I traverse against two tables by using the same oracle functions.
    My Table A can go 2 levels deep in my hierarchy and level 3 and so forth has to be done against a different table.
    Appreciate your insight..
    Thanks in advance

    The number of levels that I can traverse in the first table is dynamic (sometimes 2 levels and sometimes 3 levels and actually no level limit) and then has to dynamically start looking at second table for finding any more levels in the other table.
    I was able to implement them seperately and union them.
    I was more looking for a comprehensive solution to reduce the number of lines that I have to maintain...
    Thanks in advance
    Edited by: user566193 on Jan 15, 2010 1:58 PM

  • Query to find the list of users having access to a particular scenario

    Hi,
    I am learning Hyperion Planning 9.2 x version. I wanted to know the query to find the list of users having access to Plan Iteration - 1 scenarion.
    As I am new to Hyperion Essbase and Hyperion Planning, I am assuming these ideas work out to get the desired result.
    1) As Hyperion Planning uses Relational DB to store the User Security information, we can query the list of users who is having access to Plan Iteration - 1 Scenario.
    I am not sure if this solution works. Please correct me If I am wrong.
    2) We can also query from the essbase editor to find out who all having access to this scenario.
    If the above is correct, can you please provide me the query.
    I am really need of this and I will be happy if any one provide the solution.
    Thanks & Regards,
    Upendra. Bestha

    Hi,
    If you are looking for some SQL to retrieve the access rights by member then you can use something like (SQL Server code though can easily be modified for Oracle)
    SELECT usr.object_name as Username,mem.object_name as Member,
    'Access Rights' = CASE acc.access_mode
    WHEN -1 THEN 'None'
    WHEN 1 THEN 'Read'
    WHEN 2 THEN 'Write'
    WHEN 3 THEN 'Write'
    ELSE 'Unknown' END,
    'Relation' = CASE acc.flags
    WHEN 0 THEN 'Member'
    WHEN 5 THEN 'Children'
    WHEN 6 THEN 'Children (inclusive)'
    WHEN 8 THEN 'Descendants'
    WHEN 9 THEN 'Descendants (inclusive)'
    ELSE 'Unknown' END
    FROM
    hsp_access_control acc, hsp_object mem, hsp_object usr
    WHERE acc.object_id = mem.object_id
    AND acc.user_id = usr.object_id
    AND mem.object_name = 'Plan Iteration - 1'
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Need a query to find Grops mapped on Folders

    Hi ,
    I need a query builder query to find out the list  of folder and mapped groups to those folder.
    Would you please let me know if that is possible I triead but no luck .
    Regards,
    Neo

    Hi,
    This query sound goods but I get error 
    Select SI_NAME, SI_KIND From CI_APPOBJECTS, CI_INFOOBJECTS
    Where PARENTS("SI_NAME='Myfolder'",'CHILDREN(''SI_NAME=''UserGroup''')")
    Please let me know if I am giong in right direction becuse I never used Parents and child concept bit confused.
    All I need is when I put in my folder name it has to show me all the groups mapped to it.
    If this query gives  the result , it will be the great logic I would say
    Thanks a ot.
    Neo A

  • BO SDK Query to find all folders that a user has access to

    Hi Experts
    Please help me on BO SDK Query to "find all folders that a user has access in a single query".
    I am tried trial & error using PARENTS & CHILDREN. nothing worked
    Please advice
    Thanks!
    Prasath

    Hi Aasavari
    I am checking BO Web services samples and .NET samples. Please advice me the correct files to check the user/folder rights.
    Thank you so much
    Prasath
    http://wiki.sdn.sap.com/wiki/display/BOBJ/NETWebServicesSDKSamples

  • Query to find out the time used by an user for an application

    Hello All,
    I want to know the query to find out the whole time used by the user for an application. Please view the below data
    Employee:
    SNO EMP_ID EMP_NAME EMP_DATE LOGIN_TIME LOGOUT_TIME
    1 10 Visu 21-Nov-2010 06:30:00 07:30:00
    2 10 Visu 21-Nov-2010 06:40:00 07:20:00
    3 10 Visu 21-Nov-2010 06:50:00 07:50:00
    4 10 Visu 21-Nov-2010 07:30:00 08:30:00
    5 10 Visu 21-Nov-2010 09:30:00 10:30:00
    By checking the above data we can say that the total time Visu used the application is
    8.30 - 6.30 (From 1,2,3,4 records) = 2hrs
    10.30 - 9.30 (Based on 5th rec) = 1hr
    So the total time Visu used the application would be 3 hrs = 180 mins.
    Could you please help me in getting the result from that data using a query?

    odie_63 wrote:
    I think it may be solved with analytics too.
    with t1 as (
                select 1 sno,10 emp_id,'Visu' emp_name,'21-Nov-2010' emp_date,'06:30:00' login_time,'07:30:00' logout_time from dual union all
                select 2,10,'Visu','21-Nov-2010','06:40:00','07:20:00' from dual union all
                select 3,10,'Visu','21-Nov-2010','06:50:00','07:50:00' from dual union all
                select 4,10,'Visu','21-Nov-2010','07:30:00','08:30:00' from dual union all
                select 5,10,'Visu','21-Nov-2010','09:30:00','10:30:00' from dual
         t2 as (
                select  emp_id,
                        emp_name,
                        emp_date,
                        to_date(emp_date || login_time,'DD-MON-YYYYHH24:MI:SS') login_time,
                        to_date(emp_date || logout_time,'DD-MON-YYYYHH24:MI:SS') logout_time
                  from  t1
         t3 as (
                select  t2.*,
                        case
                          when login_time < max(logout_time) over(
                                                                  partition by emp_id,emp_date
                                                                  order by login_time
                                                                  rows between unbounded preceding
                                                                           and 1 preceding
                            then 0
                          else 1
                        end start_of_group
                  from  t2
         t4 as (
                select  t3.*,
                        sum(start_of_group) over(partition by emp_id,emp_date order by login_time) grp
                  from  t3
         t5 as (
                select  emp_id,
                        emp_date,
                        min(login_time) login_time,
                        max(logout_time) logout_time
                  from  t4
                  group by emp_id,
                           emp_date,
                           grp
    select  emp_id,
            numtodsinterval(sum(logout_time - login_time),'day') time_spent
      from  t5
      group by emp_id
      order by emp_id
        EMP_ID TIME_SPENT
            10 +000000000 03:00:00.000000000
    SQL> SY.

  • How to use ONE query to find out tree structure?

    ID------------upperID----------Name------------------------isFolder
    1------------ 0---------- Folder
    1------------------------------------1
    2------------ 1------------ Folder 1- Sub
    Folder--------------------1
    3------------ 2------------
    Folder1-Item1-A--------------------------0
    4------------ 1------------ Folder 1- Sub
    Item-----------------------0
    Hi all, if I have a table like above to demonstrate the
    folders and item relationship. This structure allows the user to
    create unlimited folders and items.
    Now I would like to use one query to find out the tree
    structure of this table, how could I do the query.
    Any help on this will be highly appreciated!
    Thanks,
    ez

    Also, see this thread:
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=1&catid=7&threadid=12 55788&enterthread=y

  • Looking for a query to find first/last dates in overlapping dates...

    Hi,
    I'm looking for a query to find the first dates and last dates in a table conaining overlapping dates.
    I have a subscription table which has for each Customer start and end date for different subscriptions.
    I want to know the different ranges of date where there is subscriptions active.
    so if the table has this:
    CustID, Start date, end date
    1, 2008-01-01, 2012-06-06
    1 ,2009-01-01, 2011-01-01
    1, 2011-01-01, 2013-02-02
    1, 2013-01-01, 2013-08-08
    1, 2014-01-01, 2014-04-04
    I want to produce this result:
    custid, range start, range end
    1, 2008-01-01, 2013-08-08
    1, 2014-01-01, 2014-04-04
    the first row is the range identified from the 4 rows in my subscription table.
    thanks :)

    I think I found it...
    http://stackoverflow.com/questions/5213484/eliminate-and-reduce-overlapping-date-ranges
    let me try this method
    Hi,
    m writing to follow up with you on this post. Thanks for you posting a reply to share your workground. Was the problem resolved after performing the above link? If you are satisfied with the above solution, I’d like to mark this issue as "Answered".
    Please also feel free to unmark the issue, with any new findings or concerns you may have.
    Thanks,
    Sofiya Li
    If you have any feedback on our support, please click here.
    Sofiya Li
    TechNet Community Support

  • Query to find out which workflow(s) use a particular message ? wf_messages

    Hi guys
    Hoping someone can help.
    I've a list of particular notfication messages, which are stored in the WF_MESSAGES_TL and WF_MESSAGES table, and I need to find out which workflows use them.
    Can anyone tell me what table I can query to find this out ?
    There's no referential integrity which I can use to find this out, and google has turned up nothing so far.
    Any ideas ?
    Thanks a lot
    Scott

    You can use this and tweak it around:
    select p.process_item_type, p.process_name, p.activity_name, a.message
    from wf_process_activities p, wf_activities a
    where p.process_item_type=a.item_type and
    p.activity_name=a.name and
    a.end_date is null;-- means the active/current activity
    Regards,
    Alejandro

  • Query to find out the list of user who have delete access

    Hi,
    I need a query to find out the list of users who have delete access on perticular folder/universe/ reports  in infoview.
    Please advice.
    Regards,
    Neo.

    orton607 wrote:
    thanks for replying guys. But the thing is i am using dynamic sql execute immediate in my package, so i want those tables also and the schema name.
    thanks,
    ortonThis is not possible. The best you could do is to have a good guess.
    Or how would you parse some dynamic statement as this:
       v_suffix := 'loyees';
       v_sql := 'Select count(*) from (select ''nonsense'' col1 from emp'||v_suffix||') where col1 = ''Y'''';
       execute_immediate(v_sql);
    ...What is the table name? How do you want to parse that?
    Better rewrite all dynamic SQL statements into non dynamic ones. Or do the source control logic for those dynamic parts in an extra module. For example implement your own dependency table and force every developer to add there all dynamic parts.

  • SQL Query to find Receipt No.s which are not matched to AP Invoices

    Hi
    Please help me to frame a query to find list of Receipt No.s which are not matched with AP Invoices.
    Please refer to the below query .
    SELECT
    poh.segment1 "PO No.",
    aps.vendor_name "Supplier Name",
    pol.item_description "Item Description",
    rcvh.receipt_num "GRV No.s",
    rcvl.quantity_received "Quantity",
    pol.unit_price "Rate/Unit",
    rcvtl.tax_name||' - '||initcap(rcvtl.tax_type) "Tax",
    (rcvl.quantity_received * pol.unit_price) + nvl(rcvtl.tax_amount,0) "Amount"
    FROM
    po_headers_all poh,
    po_lines_all pol,
    po_distributions_all pod,
    ap_suppliers aps,
    rcv_shipment_headers rcvh,
    rcv_shipment_lines rcvl,
    rcv_transactions rcvt,
    jai_rcv_line_taxes rcvtl
    WHERE
    poh.po_header_id = pol.po_header_id
    AND poh.po_header_id = pod.po_header_id
    AND pol.po_line_id = pod.po_line_id
    AND aps.vendor_id = poh.vendor_id
    AND aps.vendor_id = rcvh.vendor_id
    AND rcvh.shipment_header_id = rcvl.shipment_header_id
    AND poh.po_header_id = rcvl.po_header_id
    AND pol.po_line_id = rcvl.po_line_id
    AND rcvh.shipment_header_id = rcvt.shipment_header_id
    AND rcvl.shipment_line_id = rcvt.shipment_line_id
    AND poh.po_header_id = rcvt.po_header_id
    AND pol.po_line_id = rcvt.po_line_id
    AND aps.vendor_id = rcvt.vendor_id
    AND rcvh.shipment_header_id = rcvtl.shipment_header_id
    AND rcvl.shipment_line_id = rcvtl.shipment_line_id
    AND rcvt.transaction_id = rcvtl.transaction_id
    AND aps.vendor_id = rcvtl.vendor_id
    AND rcvt.transaction_type = 'RECEIVE'
    AND poh.authorization_status = 'APPROVED'
    AND poh.segment1 = '210001079'
    I have'nt included the Invoice Tables in the above query.
    Please help me in that area.
    This is bit urgent.
    Please help me.
    Regards
    Nakul Venkatraman

    I am using ORACLE 11gR2 If you're licensed for Diangnostics pack then you might want to look at the AWR tables, e.g. DBA_HIST_SQLSTAT and cross-reference with DBA_HIST_SNAPSHOT.
    By this will i get the top 5 consumed queries of DEV user in the whole session or its just the top 5 queries at that particular time. The "executions" columns in this query, does it mean that the no. of. times the query has executed... This will get you a random 5 queries that were first parsed by DEV. Depending on your application code/structure, it may well be that all code (except for system-recursive sql) executed by DEV is parsed by DEV, and all code parsed by DEV is executed by DEV but this isn't true for all.
    In terms of top N queries, you need to ORDER BY and then restrict by ROWNUM at an outer level to the ROWNUM otherwise the ROWNUM filter is applied before the ORDER BY.
    i.e.
    SELECT *
    FROM
    (SELECT ...
    FROM ...
    WHERE
    ORDER BY...)
    WHERE ROWNUM <= ....
    The "executions" columns in this query, does it mean that the no. of. times the query has executedYes.
    http://download.oracle.com/docs/cd/E11882_01/server.112/e25513/dynviews_3064.htm#REFRN30259
    Edited by: Dom Brooks on Oct 24, 2011 9:45 AM

  • Query to find the no of columns in a table

    Is there a query to find the total number of columns in a table?

    Dou you know read?
    -- the number of rows in a table named yourtable:
    select count(1) from yourtable;
    -- the number of columns in a table
    -- If is a user's table:
    select count(1)
    from user_tab_columns
    where table_name='YOURTABLE'
    --If it is´t
    select count(1)
    from DBA_tab_columns
    where owner = 'USEROWNER'
    and table_name='YOURTABLE'

  • Query to find the memory of database in oracle,sql

    Hi All,
    Please let me know the query to find the memory of database in oracle,sql.
    Thanks,
    sajith

    How do I find the overall database size?
    The biggest portion of a database's size comes from the datafiles. To find out how many megabytes are allocated to ALL datafiles:
    select sum(bytes)/1024/1024 "Meg" from dba_data_files;
    To get the size of all TEMP files:
    select nvl(sum(bytes),0)/1024/1024 "Meg" from dba_temp_files;
    To get the size of the on-line redo-logs:
    select sum(bytes)/1024/1024 "Meg" from sys.v_$log;
    Putting it all together into a single query:
    select a.data_size+b.temp_size+c.redo_size "total_size"
    from ( select sum(bytes) data_size
    from dba_data_files ) a,
    ( select nvl(sum(bytes),0) temp_size
    from dba_temp_files ) b,
    ( select sum(bytes) redo_size
    from sys.v_$log ) c;
    Another query ("Free space" reports data files free space):
    col "Database Size" format a20
    col "Free space" format a20
    select round(sum(used.bytes) / 1024 / 1024 ) || ' MB' "Database Size"
    , round(free.p / 1024 / 1024) || ' MB' "Free space"
    from (select bytes from v$datafile
    union all
    select bytes from v$tempfile
    union all
    select bytes from v$log) used
    , (select sum(bytes) as p from dba_free_space) free
    group by free.p
    This is what I use :P From http://www.orafaq.com/wiki/Oracle_database_FAQ#How_do_I_find_the_overall_database_size.3F

  • Query to find Employee Salary Details

    Hi,
    Could anyone help in writing the query to find employee salary details.
    Thanks in advance.

    This should get you started:
    SELECT papf.full_name
    ,papf.email_address
    ,ppp.proposed_salary_n salary
    FROM per_pay_proposals ppp
    ,per_all_assignments_f paaf
    ,per_all_people_f papf
    WHERE ppp.assignment_id = paaf.assignment_id
    AND paaf.assignment_type = 'E'
    AND paaf.primary_flag = 'Y'
    AND paaf.person_id = papf.person_id
    AND nvl(papf.current_employee_flag, 'N') = 'Y'
    AND trunc(sysdate) BETWEEN
    ppp.change_date AND ppp.date_to
    AND trunc(sysdate) BETWEEN
    paaf.effective_start_date AND paaf.effective_end_date
    AND trunc(sysdate) BETWEEN
    papf.effective_start_date AND papf.effective_end_date;

Maybe you are looking for

  • How to identify the physical IP address of AIX server on RAC Oracle 10g

    Hi All, Could you please help someone to identify the physical IP address of IBM AIX on RAC db. I have access to the database and I don't know whether the hostname mentioned in the tnsnames.ora file is virtual or physical ip adress . Is there any com

  • How do I populate an array with a directory listing.

    I have a web site that has its photos updated by another person using a content management system that I have written. As Dreamweaver does not know about these extra photos, if I try to syncronise the site on my machine for backup purposes, Dreamweav

  • Can we make TREX index only for online content

    Is it possible to have a meta tag online/offline through which we can tell Trex to search only to index the online content.

  • Can't upload video to Adobe Site

    I have been able to upload to YouTube,but can't upload to the Adobe site. I keep getting an error message.

  • Multiple instances of a view

    I need to use multiple instances of a view within a window.  I've been through the tutorial on component usage (with the 2 image views, etc.), but I need to have over 10 instances of the same view each with their own context values, etc., and setting