SQL I need help with this query Please help

List the names of all the products whose weight unit measure is “Gram”.  Order the list by product name.  Do not use JOINS, but use the IN clause with a sub-query.
select Name
from UnitMeasure
where Name= 'Gram'
order by Name
I did this, but it seem that the requirement is different.

As a guess:
Select Name from Product
where UnitMeasure in (Select Name from unitmeasure where name = 'Gram')
Andy Tauber
Data Architect
The Vancouver Clinic
Website | LinkedIn
This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click
"Mark as Answer" and "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread.

Similar Messages

  • Can any one help with this query please

    I have a table something as below
    Things_t
    Things Characteristic Char Value
    Item 1 Colour Red
    Item 1 Packaging
    Item 2 Shape Square
    Item 2 Brand Spunk
    Now i want to reterive an item with none of its char values as Null. Using the query “ select distinct things from things_t where char value is Null ” will fetch the item 1 also together with item 2. i want to fetch a record from thing for which none of the char values are Null such as Item 2. Can you please help me with this query.

    Try this:
    WITH t AS
    (SELECT 1 item_id, 17436 chr_id, 14225034 chr_val_id FROM dual UNION
    SELECT 1 item_id, 39 chr_id, 14276173 chr_val_id FROM dual UNION
    SELECT 1 item_id, 17774 chr_id, NULL chr_val_id FROM dual UNION
    SELECT 1 item_id, 265 chr_id, 20502978 chr_val_id FROM dual UNION
    SELECT 1 item_id, 16978 chr_id, 797233 chr_val_id FROM dual UNION
    SELECT 1 item_id, 13092 chr_id, 5666917 chr_val_id FROM dual UNION
    SELECT 1 item_id, 15228 chr_id, 1209758 chr_val_id FROM dual UNION
    SELECT 2 item_id, 112 chr_id,  12705342 chr_val_id FROM dual UNION
    SELECT 2 item_id, 6945 chr_id, NULL chr_val_id FROM dual UNION
    SELECT 2 item_id, 70 chr_id, 12597376 chr_val_id FROM dual UNION
    SELECT 2 item_id, 16832 chr_id, NULL chr_val_id FROM dual UNION
    SELECT 2 item_id, 7886 chr_id, 9588619 chr_val_id FROM dual UNION
    SELECT 2 item_id, 6986 chr_id, 2659351 chr_val_id FROM dual UNION
    SELECT 3 item_id, 9531 chr_id, 8910943 chr_val_id FROM dual UNION
    SELECT 3 item_id, 9798 chr_id, 8717531 chr_val_id FROM dual UNION
    SELECT 3 item_id, 17446 chr_id, 12266441 chr_val_id FROM dual UNION
    SELECT 3 item_id, 4830 chr_id, 13683090 chr_val_id FROM dual UNION
    SELECT 3 item_id, 9518 chr_id, 834772 chr_val_id FROM dual UNION
    SELECT 3 item_id, 11031 chr_id, 20233753 chr_val_id FROM dual UNION
    SELECT 3 item_id, 12564 chr_id, 2282478 chr_val_id FROM dual)
    SELECT DISTINCT item_id
    FROM   t
    MINUS
    SELECT DISTINCT item_id
    FROM   t
    WHERE  chr_val_id IS NULLOr this:
    SELECT item_id
    FROM  (SELECT   item_id,
                    MIN(NVL(chr_val_id, -1)) min_chr_val_id
           FROM     t
           GROUP BY item_id)
    WHERE  min_chr_val_id != -1Edited by: lee200 on Oct 15, 2012 9:22 AM

  • Help with this query please

    Hi there, 
    These are the sample values
    declare @table table
    Name varchar(50),
    flag int
    insert into @table
    values('Matt', 0),
    ('George', 0),
    ('George', 1),
    ('Lucas', 0),
    ('Jerome', 0),
    ('Jerome', 1)
    I want to select out where George and Jerome where flag = 0 but leave the records from the same names where flag = 1. All others that only have flag = 0, should stay. So only the names that repeat and have both flag, flag = 0 zero should be selected out.
    Thanks for your help.

    So desired output is ????
    George 0
    Jerome 0
    declare @table table
    Name varchar(50),
    flag int
    insert into @table
    values('Matt', 0),
    ('George', 0),
    ('George', 1),
    ('Lucas', 0),
    ('Jerome', 0),
    ('Jerome', 1)
    select name,min(flag) flag,count(*) from @table
    group by name
    having count(*)>1
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Please need help with this query

    Hi !
    Please need help with this query:
    Needs to show (in cases of more than 1 loan offer) the latest create_date one time.
    Meaning, In cases the USER_ID, LOAN_ID, CREATE_DATE are the same need to show only the latest, Thanks!!!
    select distinct a.id,
    create_date,
    a.loanid,
    a.rate,
    a.pays,
    a.gracetime,
    a.emailtosend,
    d.first_name,
    d.last_name,
    a.user_id
    from CLAL_LOANCALC_DET a,
    loan_Calculator b,
    bv_user_profile c,
    bv_mr_user_profile d
    where b.loanid = a.loanid
    and c.NET_USER_NO = a.resp_id
    and d.user_id = c.user_id
    and a.is_partner is null
    and a.create_date between
    TO_DATE('6/3/2008 01:00:00', 'DD/MM/YY HH24:MI:SS') and
    TO_DATE('27/3/2008 23:59:00', 'DD/MM/YY HH24:MI:SS')
    order by a.create_date

    Perhaps something like this...
    select id, create_date, loanid, rate, pays, gracetime, emailtosend, first_name, last_name, user_id
    from (
          select distinct a.id,
                          create_date,
                          a.loanid,
                          a.rate,
                          a.pays,
                          a.gracetime,
                          a.emailtosend,
                          d.first_name,
                          d.last_name,
                          a.user_id,
                          max(create_date) over (partition by a.user_id, a.loadid) as max_create_date
          from CLAL_LOANCALC_DET a,
               loan_Calculator b,
               bv_user_profile c,
               bv_mr_user_profile d
          where b.loanid = a.loanid
          and   c.NET_USER_NO = a.resp_id
          and   d.user_id = c.user_id
          and   a.is_partner is null
          and   a.create_date between
                TO_DATE('6/3/2008 01:00:00', 'DD/MM/YY HH24:MI:SS') and
                TO_DATE('27/3/2008 23:59:00', 'DD/MM/YY HH24:MI:SS')
    where create_date = max_create_date
    order by create_date

  • HT1338 I have a macbook Pro i7 mid november 2010. I am wondering if i can exchange my notebook with the latest one. Can anyone help me out with this query please.

    I have a macbook Pro i7 mid november 2010. I am wondering if i can exchange my notebook with the latest one. Can anyone help me out with this query please.

    You can sell your existing computer using eBay, Craigslist or the venue of your choice. You could then use the proceeds to purchase a new computer.

  • HT201209 I'm new to this an yesterday I bought 65$ worth of iTunes music using a iTunes gift card. Then I got these emails saying I am being billed again????? What do I do???? I'm very frustrated with this. Please help me

    yesterday I bought 65$ worth of iTunes music using a iTunes gift card. Then I got these emails saying I am being billed again????? What do I do???? I'm very frustrated with this. Please help me

    What e-mail are you talking about?
    What exactly did it say?
    Are you sure that the e-mail was not your receipt?

  • I need help with this script please ASAP

    So I need this to work properly, but when ran and the correct answer is chosen the app quits but when the wrong answer is chosen the app goes on to the next question. I need help with this ASAP, it is due tommorow. Thank you so much for the help if you can.
    The script (Sorry if it's a bit long):
    #------------Startup-------------
    display dialog "Social Studies Exchange Trviva Game by Justin Parzik" buttons {"Take the Quiz", "Cyaaaa"} default button 1
    set Lolz to (button returned of the result)
    if Lolz is "Cyaaaa" then
    killapp()
    else if Lolz is "Take the Quiz" then
              do shell script "say -v samantha Ok starting in 3…2…1…GO!"
    #------------Question 1-----------
              display dialog "Around age 11, many boys left their fathers to become…" buttons {"Scholars", "Warriors", "Apprentices"}
              set A1 to (button returned of the result)
              if A1 is "Apprentices" then
                        do shell script "say -v samantha Correct Answer"
              else
                        do shell script "say -v samantha Wrong Answer"
      #----------Question 2--------
                        display dialog "Most children were taught
    to read so that they could understand the…" buttons {"Music of Mozart", "Bible", "art of cooking"}
                        set A2 to (button returned of the result)
                        if A2 is "Bible" then
                                  do shell script "say -v samantha Correct Answer"
                        else
                                  do shell script "say -v samantha Wrong Answer"
      #------------Question 3---------
                                  display dialog "In the 1730s and 1740s, a religious movement called the_______swept through the colonies." buttons {"Glorius Revolution", "Great Awakening", "The Enlightenment"}
                                  set A3 to (button returned of the result)
                                  if A3 is "Great Awakening" then
                                            do shell script "say -v samantha Correct Answer"
                                  else
                                            do shell script "say -v samantha Wrong Answer"
      #-----------Question 4--------
                                            display dialog "_______ was
    a famous American Enlightenment figure." buttons {"Ben Franklin", "George Washington", "Jesus"}
                                            set A4 to (button returned of the result)
                                            if A4 is "Ben Franklin" then
                                                      do shell script "say -v samantha Correct Answer"
                                            else
                                                      do shell script "say -v samantha Wrong Answer"
      #----------Question 5-------
                                                      display dialog "______ ownership gave colonists political rights as well as prosperity." buttons {"Land", "Dog", "Slave"}
                                                      set A5 to (button returned of the result)
                                                      if A5 is "Land" then
                                                                do shell script "say -v samantha Correct Answer"
                                                      else
                                                                do shell script "say -v samantha Wrong Answer"
      #---------Question 6--------
                                                                display dialog "The first step toward guaranteeing these rights came in 1215. That
    year, a group of English noblemen forced King John to accept the…" buttons {"Declaration of Independence", "Magna Carta", "Constitution"}
                                                                set A6 to (button returned of the result)
                                                                if A6 is "Magna Carta" then
                                                                          do shell script "say -v samantha Correct Answer"
                                                                else
                                                                          do shell script "say -v samantha Wrong Answer"
      #----------Question 7--------
                                                                          display dialog "England's cheif lawmaking body was" buttons {"the Senate", "Parliament", "King George"}
                                                                          set A7 to (button returned of the result)
                                                                          if A7 is "Parliament" then
                                                                                    do shell script "say -v samantha Correct Answer"
                                                                          else
                                                                                    do shell script "say -v samantha Wrong Answer"
      #--------Question 8-----
                                                                                    display dialog "Pariliament decided to overthrow _______ for not respecting their rights" buttons {"King James II", "King George", "King Elizabeth"}
                                                                                    set A8 to (button returned of the result)
                                                                                    if A8 is "King James II" then
                                                                                              do shell script "say -v samantha Correct Answer"
                                                                                    else
                                                                                              do shell script "say -v samantha Wrong Answer"
      #--------Question 9------
                                                                                              display dialog "Parliament named ___ and ___ as England's new monarchs in something called ____." buttons {"William/Mary/Glorius Revolution", "Adam/Eve/Great Awakening", "Johhny/Mr.Laphalm/Burning of the hand ceremony"}
                                                                                              set A9 to (button returned of the result)
                                                                                              if A9 is "William/Mary/Glorius Revolution" then
                                                                                                        do shell script "say -v samantha Correct Answer"
                                                                                              else
                                                                                                        do shell script "say -v samantha Wrong Answer"
      #---------Question 10-----
                                                                                                        display dialog "After accepting the throne William and Mary agreed in 1689 to uphold the English Bill of _____." buttons {"Money", "Colonies", "Rights"}
                                                                                                        set A10 to (button returned of the result)
                                                                                                        if A10 is "Rights" then
                                                                                                                  do shell script "say -v samantha Correct Answer"
                                                                                                        else
                                                                                                                  do shell script "say -v samantha Wrong Answer"
      #---------Question 11------
                                                                                                                  display dialog "By the late 1600s French explorers had claimed the ___ River Valey" buttons {"Mississippi", "Ohio", "Hudson"}
                                                                                                                  set A11 to (button returned of the result)
                                                                                                                  if A11 is "Ohio" then
                                                                                                                            do shell script "say -v samantha Correct Answer"
                                                                                                                  else
                                                                                                                            do shell script "say -v samantha Wrong Answer"
      #------Question 12---------
                                                                                                                            display dialog "______ was sent to ask the French to leave 'English Land'." buttons {"Johhny Tremain", "George Washington", "Paul Revere"}
                                                                                                                            set A12 to (button returned of the result)
                                                                                                                            if A12 is "George Washington" then
                                                                                                                                      do shell script "say -v samantha Correct Answer"
                                                                                                                            else
                                                                                                                                      do shell script "say -v samantha Wrong Answer"
      #---------Question 13-------
                                                                                                                                      display dialog "_____ proposed the Albany Plan of Union" buttons {"George Washingon", "Ben Franklin", "John Hancock"}
                                                                                                                                      set A13 to (button returned of the result)
                                                                                                                                      if A13 is "Ben Franklin" then
                                                                                                                                                do shell script "say -v samantha Correct Answer"
                                                                                                                                      else
                                                                                                                                                do shell script "say -v samantha Wrong Answer"
      #--------Question 14------
                                                                                                                                                display dialog "The __________ declared that England owned all of North America east of the Mississippi" buttons {"Proclomation of England", "Treaty of Paris", "Pontiac Treaty"}
                                                                                                                                                set A14 to (button returned of the result)
                                                                                                                                                if A14 is "" then
                                                                                                                                                          do shell script "say -v samantha Correct Answer"
                                                                                                                                                else
                                                                                                                                                          do shell script "say -v samantha Wrong Answer"
      #-------Question 15-------
                                                                                                                                                          display dialog "Braddock was sent to New England so he could ______" buttons {"Command an attack against French", "Scalp the French", "Kill the colonists"}
                                                                                                                                                          set A15 to (button returned of the result)
                                                                                                                                                          if A15 is "Command an attack against French" then
                                                                                                                                                                    do shell script "say -v samantha Correct Answer"
                                                                                                                                                          else
                                                                                                                                                                    do shell script "say -v samantha Wrong Answer"
      #------TheLolQuestion-----
                                                                                                                                                                    display dialog "____ is the name of the teacher who runs this class." buttons {"Mr.White", "Mr.John", "Paul Revere"} default button 1
                                                                                                                                                                    set LOOL to (button returned of the result)
                                                                                                                                                                    if LOOL is "Mr.White" then
                                                                                                                                                                              do shell script "say -v samantha Congratulations…you…have…common…sense"
                                                                                                                                                                    else
                                                                                                                                                                              do shell script "say -v alex Do…you…have…eyes?"
                                                                                                                                                                              #------END------
                                                                                                                                                                              display dialog "I hope you enjoyed the quiz!" buttons {"I did!", "It was horrible"}
                                                                                                                                                                              set endmenu to (button returned of the result)
                                                                                                                                                                              if endmenu is "I did!" then
                                                                                                                                                                                        do shell script "say -v samantha Your awesome"
                                                                                                                                                                              else
                                                                                                                                                                                        do shell script "say -v alex Go outside and run a lap"
                                                                                                                                                                              end if
                                                                                                                                                                    end if
                                                                                                                                                          end if
                                                                                                                                                end if
                                                                                                                                      end if
                                                                                                                            end if
                                                                                                                  end if
                                                                                                        end if
                                                                                              end if
                                                                                    end if
                                                                          end if
                                                                end if
                                                      end if
                                            end if
                                  end if
                        end if
              end if
    end if

    Use code such as:
    display dialog "Around age 11, many boys left their fathers to become…" buttons {"Scholars", "Warriors", "Apprentices"}
    set A1 to (button returned of the result)
    if A1 is "Apprentices" then
    do shell script "say -v samantha Correct Answer"
    else
    do shell script "say -v samantha Wrong Answer"
    return
    end if
    #----------Question 2--------
    display dialog "Most children were taught to read so that they could understand the…" buttons {"Music of Mozart", "Bible", "art of cooking"}
    set A2 to (button returned of the result)
    if A2 is "Bible" then
    do shell script "say -v samantha Correct Answer"
    else
    do shell script "say -v samantha Wrong Answer"
    return
    end if
    (90444)

  • Need help with Portal Themes -- Please help

    I need help with Portal Themes.  I have read every document I can find but I am having no luck.  All I want to do is change the colors for the Exceptions on one of my queries.  I have created my own Portal Theme where I have changed the colors but I do not know how to assign my newly-created Portal Theme to my query.  Can someone please give me the detailed steps on how to do this? Please help because this is driving me crazy.
    Thanks.
    Ryan

    Hi,
    Refer
    Exceptions - How to change the colors
    This may help.
    Thanks,
    JituK

  • Hi apple am new user to apple i just bought i phone 4s  and  i set up passowrd and forgot it how  and the iphone is not responding now how can i deal with this broblem please helpe

    hi apple am new user to apple i just bought i phone 4s  and  i set up passowrd and forgot it how  and the iphone is not responding now how can i deal with this broblem please helpe

    iPhone User Guide (For iOS 5.1 Software)

  • Please tell me anything wrong in this query please help me follwing query

    SELECT o100161.ORG_STRUCTURE_VERSION_ID as E100351,AVG(o100163.PLANNED) as E100360_AVG,AVG(o100163.ACTUAL) as E100180_AVG,( SUM(fx102) )-( SUM(fx103) ) as C_1,( SUM(fx105) )-( SUM(fx106) ) as C_2,( SUM(fx108) )-( SUM(fx109) ) as C_3
    FROM ( SELECT o100165.SEGMENT1 AS fx100, SUM(o100165.ACR) AS fx102, SUM(o100165.ADR) AS fx103, SUM(o100165.BDR) AS fx105, SUM(o100165.BCR) AS fx106, SUM(o100165.ECR) AS fx108, SUM(o100165.EDR) AS fx109 FROM ( SELECT
    nvl(src.user_je_source_name, '**************') SOURCE,
    nvl(cat.user_je_category_name, '**************') CATEGORY,
    jeh.name NAME,
    jel.code_combination_id CCID,
    jeh.DEFAULT_EFFECTIVE_DATE,
    jel.period_name PERIOD_NAME,
    jel.effective_date EFFECTIVE_DATE,
    jel.description DESCRIPTION,
    seq.name SEQUENCE_NAME,
    jeh.doc_sequence_value DOCUMENT_NUMBER,
    jel.accounted_dr,
    jel.accounted_cr,
    decode(jeh.actual_flag,'B',jel.accounted_dr,'E',0,'A',0)bdr,
    decode(jeh.actual_flag,'B',jel.accounted_Cr,'E',0,'A',0)bcr,
    decode(jeh.actual_flag,'B',0,'E',jel.accounted_Dr,'A',0)EDr,
    decode(jeh.actual_flag,'B',0,'E',jel.accounted_Cr,'A',0)ECr,
    decode(jeh.actual_flag,'B',0,'E',0,'A',jel.accounted_Dr)ADr,
    decode(jeh.actual_flag,'B',0,'E',0,'A',jel.accounted_Cr)ACr,
    jel.JE_LINE_NUM,
    cc.segment7 Project_COA_No,
    cc.description Segment_description,
    pa.segment1,
    jeh.actual_flag,
    PA.NAME PROJECT_NAME,
    cc.segment1||'.'||cc.segment2||'.'||cc.segment3||'.'||cc.segment4||'.'||cc.segment5 seg_desc
    FROM gl_je_lines jel,
    gl_code_combinations cc,
    gl_je_headers jeh,
    -- gl_je_batches jeb,
    gl_je_categories cat,
    gl_je_sources src,
    fnd_document_sequences seq,
    pa_projects_all pa,
    XXEPM_FINANCE_INTEGRATION XX
    WHERE
    ((nvl(accounted_dr,0) != 0 OR nvl(accounted_cr,0) != 0) OR
    (nvl(accounted_dr,0) = 0 AND nvl(accounted_cr,0) = 0 AND
    stat_amount is not NULL))
    AND jeh.je_header_id = jel.je_header_id
    AND src.je_source_name = jeh.je_source
    AND cat.je_category_name = jeh.je_category
    AND seq.doc_sequence_id(+) = jeh.doc_sequence_id
    AND jel.code_combination_id = cc.code_combination_id
    AND XX.EPM_PA_NO=PA.SEGMENT1
    AND XX.FINANCE_PA_COA_SEG=CC.SEGMENT7
    ORDER BY jeh.name, jel.je_line_num
    ) o100165 GROUP BY o100165.SEGMENT1) ,
    ( select * from PER_ORG_STRUCTURE_ELEMENTS_V
    ) o100161,
    ( SELECT PPA.CARRYING_OUT_ORGANIZATION_ID Organization, PPA.PROJECT_ID as "Project ID",ppa.segment1 as "Project No" ,PPA.NAME as "Project Name",
    nvl(trunc(((sysdate - PPA.SCHEDULED_START_DATE)/( PPA.scheduled_finish_date - PPA.SCHEDULED_START_DATE) *100 )),0) Planned,
    nvl(TRUNC(AVG(PPC.COMPLETED_PERCENTAGE)),0) Actual
    FROM PA_PROJECTS_ALL PPA , PA_PERCENT_COMPLETES PPC
    WHERE PPA.CARRYING_OUT_ORGANIZATION_ID IN (SELECT A.ORGANIZATION_ID_CHILD
    FROM PER_ORG_STRUCTURE_ELEMENTS_V A, PA_IMPLEMENTATIONS_ALL B
    WHERE A.ORG_STRUCTURE_VERSION_ID= B.ORG_STRUCTURE_VERSION_ID)
    AND PPA.TEMPLATE_FLAG='N'
    AND PPC.PROJECT_ID(+) = PPA.PROJECT_ID
    GROUP BY PPA.CARRYING_OUT_ORGANIZATION_ID,PPA.PROJECT_ID,ppa.segment1, PPA.NAME ,PPA.SCHEDULED_START_DATE,PPA.scheduled_finish_date
    ) o100163
    WHERE ( (o100163."Project No" = fx100)
    and (o100161.ORGANIZATION_ID_CHILD = o100163.ORGANIZATION))
    GROUP BY o100161.ORG_STRUCTURE_VERSION_ID;
    the second query is as follows
    SELECT o100163."Project Name" as E100386,( SUM(o100165.ACR) )-( SUM(o100165.ADR) ) as C_1,( SUM(o100165.BDR) )-( SUM(o100165.BCR) ) as C_2,( SUM(o100165.ECR) )-( SUM(o100165.EDR) ) as C_3
    FROM ( SELECT PPA.CARRYING_OUT_ORGANIZATION_ID Organization, PPA.PROJECT_ID as "Project ID",ppa.segment1 as "Project No" ,PPA.NAME as "Project Name",
    nvl(trunc(((sysdate - PPA.SCHEDULED_START_DATE)/( PPA.scheduled_finish_date - PPA.SCHEDULED_START_DATE) *100 )),0) Planned,
    nvl(TRUNC(AVG(PPC.COMPLETED_PERCENTAGE)),0) Actual
    FROM PA_PROJECTS_ALL PPA , PA_PERCENT_COMPLETES PPC
    WHERE PPA.CARRYING_OUT_ORGANIZATION_ID IN (SELECT A.ORGANIZATION_ID_CHILD
    FROM PER_ORG_STRUCTURE_ELEMENTS_V A, PA_IMPLEMENTATIONS_ALL B
    WHERE A.ORG_STRUCTURE_VERSION_ID= B.ORG_STRUCTURE_VERSION_ID)
    AND PPA.TEMPLATE_FLAG='N'
    AND PPC.PROJECT_ID(+) = PPA.PROJECT_ID
    GROUP BY PPA.CARRYING_OUT_ORGANIZATION_ID,PPA.PROJECT_ID,ppa.segment1, PPA.NAME ,PPA.SCHEDULED_START_DATE,PPA.scheduled_finish_date
    ) o100163,
    ( SELECT
    nvl(src.user_je_source_name, '**************') SOURCE,
    nvl(cat.user_je_category_name, '**************') CATEGORY,
    jeh.name NAME,
    jel.code_combination_id CCID,
    jeh.DEFAULT_EFFECTIVE_DATE,
    jel.period_name PERIOD_NAME,
    jel.effective_date EFFECTIVE_DATE,
    jel.description DESCRIPTION,
    seq.name SEQUENCE_NAME,
    jeh.doc_sequence_value DOCUMENT_NUMBER,
    jel.accounted_dr,
    jel.accounted_cr,
    decode(jeh.actual_flag,'B',jel.accounted_dr,'E',0,'A',0)bdr,
    decode(jeh.actual_flag,'B',jel.accounted_Cr,'E',0,'A',0)bcr,
    decode(jeh.actual_flag,'B',0,'E',jel.accounted_Dr,'A',0)EDr,
    decode(jeh.actual_flag,'B',0,'E',jel.accounted_Cr,'A',0)ECr,
    decode(jeh.actual_flag,'B',0,'E',0,'A',jel.accounted_Dr)ADr,
    decode(jeh.actual_flag,'B',0,'E',0,'A',jel.accounted_Cr)ACr,
    jel.JE_LINE_NUM,
    cc.segment7 Project_COA_No,
    cc.description Segment_description,
    pa.segment1,
    jeh.actual_flag,
    PA.NAME PROJECT_NAME,
    cc.segment1||'.'||cc.segment2||'.'||cc.segment3||'.'||cc.segment4||'.'||cc.segment5 seg_desc
    FROM gl_je_lines jel,
    gl_code_combinations cc,
    gl_je_headers jeh,
    -- gl_je_batches jeb,
    gl_je_categories cat,
    gl_je_sources src,
    fnd_document_sequences seq,
    pa_projects_all pa,
    XXEPM_FINANCE_INTEGRATION XX
    WHERE
    ((nvl(accounted_dr,0) != 0 OR nvl(accounted_cr,0) != 0) OR
    (nvl(accounted_dr,0) = 0 AND nvl(accounted_cr,0) = 0 AND
    stat_amount is not NULL))
    AND jeh.je_header_id = jel.je_header_id
    AND src.je_source_name = jeh.je_source
    AND cat.je_category_name = jeh.je_category
    AND seq.doc_sequence_id(+) = jeh.doc_sequence_id
    AND jel.code_combination_id = cc.code_combination_id
    AND XX.EPM_PA_NO=PA.SEGMENT1
    AND XX.FINANCE_PA_COA_SEG=CC.SEGMENT7
    ORDER BY jeh.name, jel.je_line_num
    ) o100165
    WHERE ( (o100163."Project No" = o100165.SEGMENT1))
    GROUP BY o100163."Project Name";

    > please tell me anything wrong in this query
    Umm, it's completely unreadable?
    Even formatted (with a little help from the wangz.net online SQL formatter, though it needed some manual editing) it's pretty hard to see what it's meant to be doing, due to all the nesting and cryptic naming. This is just the first one:
    SELECT o100161.org_structure_version_id AS e100351
         , AVG(o100163.planned) AS e100360_avg
         , AVG(o100163.actual) AS e100180_avg
         , SUM(fx102) - SUM(fx103) AS c_1
         , SUM(fx105) - SUM(fx106) AS c_2
         , SUM(fx108) - SUM(fx109) AS c_3
    FROM   ( SELECT o100165.segment1 AS fx100
                  , SUM(o100165.acr) AS fx102
                  , SUM(o100165.adr) AS fx103
                  , SUM(o100165.bdr) AS fx105
                  , SUM(o100165.bcr) AS fx106
                  , SUM(o100165.ecr) AS fx108
                  , SUM(o100165.edr) AS fx109
             FROM   GG( SELECT NVL(src.user_je_source_name,'**************') source
                           , NVL(cat.user_je_category_name,'**************') category
                           , jeh.NAME NAME
                           , jel.code_combination_id ccid
                           , jeh.default_effective_date
                           , jel.period_name period_name
                           , jel.effective_date effective_date
                           , jel.description description
                           , seq.NAME sequence_name
                           , jeh.doc_sequence_value document_number
                           , jel.accounted_dr
                           , jel.accounted_cr
                           , DECODE(jeh.actual_flag, 'B',jel.accounted_dr, 'E',0, 'A',0) bdr
                           , DECODE(jeh.actual_flag, 'B',jel.accounted_cr, 'E',0, 'A',0) bcr
                           , DECODE(jeh.actual_flag, 'B',0, 'E',jel.accounted_dr, 'A',0) edr
                           , DECODE(jeh.actual_flag, 'B',0, 'E',jel.accounted_cr, 'A',0) ecr
                           , DECODE(jeh.actual_flag, 'B',0, 'E',0, 'A',jel.accounted_dr) adr
                           , DECODE(jeh.actual_flag, 'B',0, 'E',0, 'A',jel.accounted_cr) acr
                           , jel.je_line_num
                           , cc.segment7 project_coa_no
                           , cc.description segment_description
                           , pa.segment1
                           , jeh.actual_flag
                           , pa.NAME project_name
                           , cc.segment1 ||'.' ||cc.segment2 ||'.' ||cc.segment3 ||'.'
                           ||cc.segment4 ||'.' ||cc.segment5 seg_desc
                      FROM   gl_je_lines jel
                           , gl_code_combinations cc
                           , gl_je_headers jeh
                           , gl_je_categories cat
                           , gl_je_sources src
                           , fnd_document_sequences seq
                           , pa_projects_all pa
                           , xxepm_finance_integration xx
                      WHERE  (    ( NVL(accounted_dr,0) != 0 OR NVL(accounted_cr,0) != 0 )
                              OR  (    NVL(accounted_dr,0) = 0
                                   AND NVL(accounted_cr,0) = 0
                                   AND stat_amount IS NOT NULL ) )
                      AND    jeh.je_header_id = jel.je_header_id
                      AND    src.je_source_name = jeh.je_source
                      AND    cat.je_category_name = jeh.je_category
                      AND    seq.doc_sequence_id (+)  = jeh.doc_sequence_id
                      AND    jel.code_combination_id = cc.code_combination_id
                      AND    xx.epm_pa_no = pa.segment1
                      AND    xx.finance_pa_coa_seg = cc.segment7
                      ORDER BY jeh.NAME, jel.je_line_num) o100165
              GROUP BY o100165.segment1)
         , ( SELECT *
             FROM   per_org_structure_elements_v) o100161
         , ( SELECT ppa.carrying_out_organization_id organization
                  , ppa.project_id AS "Project ID"
                  , ppa.segment1 AS "Project No"
                  , ppa.NAME AS "Project Name"
                  , NVL
                    ( TRUNC
                      ( ( (SYSDATE - ppa.scheduled_start_date) /
                          (ppa.scheduled_finish_date - ppa.scheduled_start_date) * 100)
                    , 0) planned
                  , NVL(TRUNC(AVG(ppc.completed_percentage)),0) actual
             FROM   pa_projects_all ppa
                  , pa_percent_completes ppc
             WHERE  ppa.carrying_out_organization_id IN
                    ( SELECT a.organization_id_child
                      FROM   per_org_structure_elements_v a
                           , pa_implementations_all b
                      WHERE  a.org_structure_version_id = b.org_structure_version_id )
             AND    ppa.template_flag = 'N'
             AND ppc.project_id (+)  = ppa.project_id
             GROUP BY
                    ppa.carrying_out_organization_id
                  , ppa.project_id
                  , ppa.segment1
                  , ppa.NAME
                  , ppa.scheduled_start_date
                  , ppa.scheduled_finish_date ) o100163
    WHERE  o100163."Project No" = fx100
    AND    o100161.organization_id_child = o100163.organization
    GROUP BY o100161.org_structure_version_id;

  • Can anyone help with this query

    create table customer(
    customer_email varchar(100) not null
    ,cust_id int not null
    ,constraint pk__customer primary key clustered(cust_id)
    Please help ASAP
    create table purchase (
    purchase_id int not null identity(1,1)
    ,cust_id int not null references customer(cust_id)
    ,product_name varchar(200) not null
    ,amount int not null
    ,constraint pk__purchase primary key clustered (purchase_id)
    Write a query that returns one row per customer with the following columns. Don't forget about customers with no purchases.
    customer_email
    qty of purchase
    sum of purchase amount

    Homework deadline looming?
    This will work in versions of Oracle from 9 up, and in all versions of Sybase/ SQL Server (which you seem to wnat based on the CREATE TABLE syntax).
    SELECT customer_email, COUNT(*) number_purchaes, SUM(amount) total_purchases
    FROM customer c
         LEFT OUTER JOIN purchases p ON c.cust_id = p.cust_id
    GROUP BY customer_emailTTFN
    John

  • PROBLEM WITH HIERARCHICAL QUERY - PLEASE HELP

    I have got three tables :
    CREATE TABLE FIRM
    (FID INTEGER NOT NULL PRIMARY KEY,
    FNAME VARCHAR(40),
    FTYPE VARCHAR(3),
    MASTERID INTEGER );
    CREATE TABLE FACULTY
    (FAID INTEGER NOT NULL PRIMARY KEY,
    FANAME VARCHAR(40),
    FATYPE VARCHAR(3),
    MASTERID INTEGER );
    CREATE TABLE EMPLOYEE
         (EID INTEGER NOT NULL PRIMARY KEY,
    ENAME VARCHAR(20),
    ESURNAME VARCHAR(20),
         EJOB VARCHAR(3),
         MASTERID INTEGER );
    This is a hierarchical tree(or is ment to be, I,m complete rookie ) . Firm can be the root or can be slave to another firm. Faculty can be slave to firm, or to another faculty. Employee can be slave to faculty or to another employee(e.g. boss). This connections are specified by MASTERIDs.
    I need to write a procedure, which parameter would be node ID. It is meant to create a VIEW from this node as if it was a root (view of a subtree).
    I tried CONNECT BY clause but it works only on one table at a time and I have here three tables.
    I completely don,t know how to write it. Please help.

    create view hierarchy as
    select id, master_id, name from table1
    union all
    select id, master_id, name from table2
    union all
    select id, master_id, name from table3
    Then do your connect by query against hierarchy.
    It will not work in 8i (connect by on views not allowed), so you will need to materialize the view.
    Kirill

  • What am i doing wrong with this class please help

    What am i doing wrong with this class? I'm trying to create a JFrame with a JTextArea and a ScrollPane so that text can be inserted into the text area. however evertime i run the program i cannot see the textarea but only the scrollpane. please help.
    import java.io.*;
    import java.util.*;
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class Instructions extends JFrame{
    public JTextArea textArea;
    private String s;
    private JScrollPane scrollPane;
    public Instructions(){
    super();
    textArea = new JTextArea();
    s = "Select a station and then\nadd\n";
    textArea.append(s);
    textArea.setEditable(true);
    scrollPane = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    this.getContentPane().add(textArea);
    this.getContentPane().add(scrollPane);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setTitle("Instructions");
    this.setSize(400,400);
    this.setVisible(true);
    }//end constructor
    public static void main(String args[]){
    new Instructions();
    }//end class

    I'm just winging this so it might be wrong:
    import java.io.*;
    import java.util.*;
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class Instructions extends JFrame{
    public JTextArea textArea;
    private String s;
    private JScrollPane scrollPane;
    public Instructions(){
    super();
    textArea = new JTextArea();
    s = "Select a station and then\nadd\n";
    textArea.append(s);
    textArea.setEditable(true);
    scrollPane = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    // Here you already have textArea in scrollPane so no need to put it in
    // content pane, just put scrollPane in ContentPane.
    // think of it as containers within containers
    // when you try to put them both in at ContentPane level it will use
    // it's layout manager to put them in there side by side or something
    // so just leave this out this.getContentPane().add(textArea);
    this.getContentPane().add(scrollPane);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setTitle("Instructions");
    this.setSize(400,400);
    this.setVisible(true);
    }//end constructor
    public static void main(String args[]){
    new Instructions();
    }//end class

  • Got dizzy with this problem,please help!

    I am trying to write a simple pagingGrid component,but i don't know why when i click next page icon,it still show the first page. i wrote a scroller component ,its renderer and a scroller tag.The paging process is like this, taking "next" action for example, and please be patient:
    Step 1 i click the "next" icon, in the renderer it is rendered like this:
    String clientId = component.getClientId(context);
             String formId=RendererUtil.getFormId(context,component);
             ScrollerAction scrollerAction=TagUtil.getCurrentScrollerAction();
             String path="http://localhost:8080/JSFOnStart/index.faces";
             scrollerAction.setClientID(clientId);
             scrollerAction.setFormID(formId);
             String imagePath="next.gif";
              writer.startElement("a", component);
             writer.writeAttribute("href", path, null);
             writer.writeAttribute("onclick",
                      // submit form in which the scroller resides
                       "document.forms['" + formId + "'].submit(); ", null);
             writer.startElement("img",component);
             writer.writeAttribute("src",imagePath,null);
             writer.endElement("img");
             writer.endElement("a");
             scrollerAction.setAction("next");The scrollerAction is a managed bean of ScrollerAction class with the session scope.I think I could share information between components by storing the info in session scoped managed bean,and every time i need it, i use the following code to get the instance:
    public static ScrollerAction getCurrentScrollerAction()
                   FacesContext context=FacesContext.getCurrentInstance();
                   Application app=context.getApplication();
                   VariableResolver vr=app.getVariableResolver();
                   ScrollerAction scroller=(ScrollerAction)vr.resolveVariable(context,"scrollerAction");     
                  return scroller;
              }I think during the session,i will always get the same instance no matter in which component i invoke the above method,maybe some problem with this?
    Step 2: In the setProperties(..) method of PagingGridTag class, i get the ScrollerAction instance with the above getCurrentScrollerAction() method,and in the very similar way, i got a PagingParam instance which is also a session scoped managed bean and it stores the information like currentPage, totalPages and so on. By using the two instances, I got the action value and infos like current page and total page count.Based on these information, i do some calculation to set the value of current page,rows to be displayed,start row index and so on, the calculation is simple and i am sure it is right.The corresponding component is HtmlPagingGrid which is a subclass of HtmlDataTable, and i can set the "rowIndex" and "rows" of it to do paging.
    But i don't know why it is not working well when i click the "next" icon.
    Maybe it is one of such problems below or some other problems:
    1 the javascript part is not right, i only use one page "index.jsp" to test it out.
    2 everytime i try to get ScrollerAction and PagingParams instances,actually i got a new instances, so the informations are always for the first page.
    The whole thing seems not complex,but i got really dizzy with it, and if you are interested in this topic and want to have the code to check the problem out, please send an email to me,mine is [email protected], then i will reply your email with my code attached.Thanks:)
    Best Regards:)
    Robin

    *i deleted all my music on itunes to free up disc space on my pc.*
    Why not leave it on the external drive and let iTunes use that for all your music?
    *as i manually manage my itunes so as not to reload my music in a file*
    I have no idea what this means.
    I autosync my iPod with selected playlists.
    Only new songs get loaded onto the iPod and old songs get taken off. It doesn't reload everything.
    If yopu cannot find the podcasts on the iPod to delete them, you will need to restore the iPod.

  • Help with this problem please GasPump.java

    I've been working on this program for a week now and i have not gotten it to complie yet. Could anybody help me out? Your help would be greatly appreciated. Thanks.
    public class GasPump {
          double pricePerGallon;
          double gallons;
          int fuelType;
          int paymentType;
          float washPrice;
          String fuelName;
           public GasPump ( )  
             { pricePerGallon = 2.699; }
           public GasPump ( double price)  
             { pricePerGallon = price; }        
           public void setCost(double cost)   
             { double pricePerGallon  = cost; }
           double  getCost( )
             { return pricePerGallon; }
           public setGrade(int fuelType)
             { String fuelName;
            switch (fuelType)
                   case 1:    fuelName = ?Regular Unleaded?
                                  break;
                   case 2:    fuelName = ?Mid grade Unleaded?
                                  break;
                   case 3:    fuelName = ?Super Unleaded?
                                  break;
                   case 4:    fuelName = ?Diesel?
                                  break;
                   case 5:    fuelName = ?Natural Gas?
                                  break;
                   default:   System.out.println(?Unknown fuel type? + fuelType);
                               fuelName = ?Unknown?;
                   public String getGrade ( )
                   { return fuelName; }
                   double calcBill (double gallons)
                   { return(pricePerGallon * gallons); }
                   void paymentMethod(int  paymentType)    
                    if (paymentType  == 1)
                   payInsideMethod();
                    else
                          if (paymentType == 2)
                    payOutsideMethod();
                          else
                        if (paymentType == 3)
                       payInsideMethod ( );   
                          else
                     System.out.println(?Unknown payment type?);
                void payInsideMethod( )
                     System.out.println(?Pay cashier inside the gas station?);
                void payOutsideMethod( )
                System.out.println(?Please pay with your credit card ?);
               float   carWash (int washType)
                 washPrice = 0.00f;       
                  if (washType == 1)
                    washPrice = 7.00f;   
                      else
                  if (washType == 2)
                             washPrice = 8.00f; 
                  else
                            System.out.println(?Unknown wash type?);
                      return  (float)washPrice;   
                       void printReceipt ( )  
                        /*     System.out.println(fuelName + ? ? +gallons + ? Gallons purchased at $ ? + 
                               pricePerGallon + ? per gallon ? + ? Total cost is:  ? + 
                               pricePerGallon * gallons + ? Total bill is $ :" +
                               ((pricePerGallon * gallons) + washPrice)); */
                           System.out.printf("%s %.2f Gallons purchased at $%.2f per gallon.\nTotal
                  cost is: %.2f",
                                               fuelName, gallons, pricePerGallon, pricePerGallon *
                  gallons);
                       System.out.printf(" Total bill is $: %.2f", ((pricePerGallon * gallon) +
               washPrice));
               }

    sorry my compile errors read
    GasPump.java:31: illegal character: \8220
             case 3:    fuelName = ?Super Unleaded?;
                                   ^
    GasPump.java:31: illegal character: \8221
             case 3:    fuelName = ?Super Unleaded?;
                                                  ^
    GasPump.java:33: illegal character: \8220
             case 4:    fuelName = ?Diesel?;
                                   ^
    GasPump.java:33: illegal character: \8221
             case 4:    fuelName = ?Diesel?;
                                          ^
    GasPump.java:35: illegal character: \8220
             case 5:    fuelName = ?Natural Gas?;
                                   ^
    GasPump.java:35: illegal character: \8221
             case 5:    fuelName = ?Natural Gas?;
                                               ^
    GasPump.java:37: illegal character: \8220
            default:   System.out.println(?Unknown fuel type? + fuelType);
                                          ^
    GasPump.java:37: illegal character: \8221
            default:   System.out.println(?Unknown fuel type? + fuelType);
                                                            ^
    GasPump.java:37: ')' expected
            default:   System.out.println(?Unknown fuel type? + fuelType);
                                                                         ^
    GasPump.java:38: illegal character: \8220
                               fuelName = ?Unknown?;
                                          ^
    GasPump.java:38: illegal character: \8221
                               fuelName = ?Unknown?;
                                                  ^
    GasPump.java:59: illegal character: \8220
                              System.out.println(?Unknown payment type?);
                                                 ^
    GasPump.java:59: illegal character: \8221
                              System.out.println(?Unknown payment type?);
                                                                      ^
    GasPump.java:59: ')' expected
                              System.out.println(?Unknown payment type?);
                                                                        ^
    GasPump.java:64: illegal character: \8220
                      System.out.println(?Pay cashier inside the gas station?);
                                         ^
    GasPump.java:64: illegal character: \8221
                      System.out.println(?Pay cashier inside the gas station?);
                                                                            ^
    GasPump.java:64: ')' expected
                      System.out.println(?Pay cashier inside the gas station?);
                                                                              ^
    GasPump.java:69: illegal character: \8220
                      System.out.println(?Pay at the pump with credit card ?);
                                         ^
    GasPump.java:69: illegal character: \8221
                      System.out.println(?Pay at the pump with credit card ?);
                                                                           ^
    GasPump.java:69: ')' expected
                      System.out.println(?Pay at the pump with credit card ?);
                                                                             ^
    GasPump.java:82: illegal character: \8220
                             System.out.println(?Unknown wash type?);
                                                ^
    GasPump.java:82: illegal character: \8221
                             System.out.println(?Unknown wash type?);
                                                                  ^
    GasPump.java:82: ')' expected
                             System.out.println(?Unknown wash type?);
                                                                    ^
    GasPump.java:94: unclosed string literal
                           System.out.printf("%s %.2f Gallons purchased at $%.2f per
    gallon.\nTotal
                                             ^
    GasPump.java:95: unclosed string literal
                   cost is: %.2f",
                                ^
    GasPump.java:97: ')' expected
                     gallons);
                             ^
    26 errorsBasically wherever I have a quotation mark or a semi-colon there is a error there. I just started programming so im still trying to get the hang of it

Maybe you are looking for

  • Site works in IE, but not in Firefox

    First, some particulars:  I am on Windows 7, Internet Explorer 8, Firefox 4, and Flash player version 10.2.159.1. In making a few small updates to a website (no functionality changes, just cosmetic ones), I find that now the site will not work proper

  • Problem with Organizer

    I want to organize photo order in album, but when I create and select album I only have op tion to sort by date.  "Album Order" does not appear.  Am I do something wrong?

  • CLASSIFIACTION_DESTINATION - What roles must the user have?

    Hi all, I have created the CLASSIFICATION_DESTINATION in PI 7.1. Now I want to publish a service from ERP. I get always the same error: Error during cache update for classification system meta data/values Invalid Response code (401). Server          

  • Interfaces for RFID

    Hello Everyone I'm new to WM and i have got couple of questions...... 1. what are the interfaces availble for RFID devices to integrate in to WM module and how do we develop those interfaces as a fuctional consultant........i mean the settings we hav

  • JDBC SENDER PROBLEM

    HI, I M DOING JDBC - XI -FILE SCENARIO JDBC SENDER POLLS THE DATA BASE BUT ITS NOT POLLING THE DATA IN THE DATABASE.IN COMM CHANNEL MONITORING ITS SHOWING PROCESSING FINISHED SUCCESFULLY BUT THERE ARE NO MESSAGES SHOWN IN SXMB_MONI. PLZ HELP