Help with a VERY DIFFICULT Query.  Anyone up for the task?

Hi, I have been struggling with this query for a week now and have made a little progress but not much: I apoligize for the long post but it needs explanation. Let me set up the question first.
I have a query that needs to run for a crystal report graph per supplier. This report is run ONCE per supplier(per record) and will return the current supplier's name, commodity(manufacturing part type) and index points(parts that have failures). It will also return all of the other suppliers with the same commodity, their index points, and a BLANK entry for their supplier name. The purpose of this is so that the supplier can see our companies ranking of suppliers by commodity, but should only know where they are ranked, not other suppliers. So in the bar graph legend, on the x-axis all you will see is a single label(the report's current record...supplier). Now for the table setup.
The query pulls from three tables:
1. VEN_LOC , master supplier table, includes all of our supplier's ID's(PK) and names
2. C_VENCOM , detached table, includes all of our supplier's ID's and commodity PK is (SupplierID,commodity)
3. QA_OCC , detached table, entries in this table are only inserted when there is a failure occurrence(index points). If a supplier does not have any failures during a specific date range (column OCCDATE) then there will be no records for that supplier in this table...this is where my problem comes from. Please read to end to understand problem.
Now for the query. Notice the union...the first part returns the current supplier's ID, name, commodity, and indexpoints. The second half of the query is what returns every other supplier with the same commodity, but returns '' for the supplier's name:
select supname,commodity,ip from(
select supname,commodity,ip from
(select v.name as supname, c.commodity, sum(q.indexpoints+q.lateindexpoints) as ip
from qa_occ q, c_vencom c, ven_loc v
where q.occdate between to_date('4/1/2006','mm/dd/yyyy')
and to_date('3/31/2007','mm/dd/yyyy')
and v.vendor='10063'
and v.vendor=c.vendor
and c.vendor=q.supplier
and v.ven_loc=c.pur_loc
and c.pur_loc=q.SUPPLIERLOC
group by v.name, c.commodity)
union
select '' as supname,commodity,ip from
(select v.name as supname, c.commodity, sum(q.indexpoints+q.lateindexpoints) as ip
from qa_occ q, c_vencom c, ven_loc v
where q.occdate between to_date('4/1/2006','mm/dd/yyyy')
and to_date('3/31/2007','mm/dd/yyyy')
and v.vendor<>'10063'
and v.vendor=c.vendor
and c.vendor=q.supplier
group by v.name, c.commodity)
order by commodity, ip desc) qa
where qa.commodity in (
select commodity from c_vencom
where vendor='10063')
group by commodity,supname,ip
order by commodity,supname,ip
This will return the following recordset:
SUPNAME      COMMODITY     IP
KF Corp.      FASTENER     63
     FASTENER     12
     FASTENER     33
     FASTENER     126
     FASTENER     153
KF Corp.      RUBBER      63
     RUBBER     12
     RUBBER      226
     RUBBER      259
This works like it should....
But... Here is where it gets really really tricky for me and the problem. Even if a supplier has no index points for a given date range, I still have to return a recordset with the supplier's name, commodity, and indexpoints of zero along with all other suppliers but names as ''.
So.. for example, one of our suppliers with ID# 10143 has no index points during the date range 4/1/2006-3/31/2007 so there are zero entries for this supplier in QA_OCC. Therefore the query returns only the other suppliers with this commodity but without 10143's suppliername, commodity, or index points of zero. so:
SUPNAME     COMMODITY     IP
     PLASTIC      12
     PLASTIC      45
     PLASTIC      51
     PLASTIC      78
When it should return no matter what:
SUPNAME     COMMODITY     IP
Emhart PLASTIC 0
     PLASTIC      12
     PLASTIC      45
     PLASTIC      51
     PLASTIC      78
Understand? If you need further info don't hesitate to e-mail me at [email protected]. Thank you.
Eric

Thanks but it doesnt change the results. Still not returning the supplier that has no records in QA_OCC..HOWEVER it is returning an extra result, still without name or 0 indexpoints though
SUPNAME     COMMODITY     IP
     PLASTIC     12
     PLASTIC     45
     PLASTIC     51
     PLASTIC     78
     PLASTIC     
select supname,commodity,ip from(
select supname,commodity,ip from
select v.name as supname, c.commodity, sum(q.indexpoints+q.lateindexpoints) as ip
from qa_occ q right outer join glovia_prod.c_vencom@gl7test c
on q.occdate between to_date('4/1/2006','mm/dd/yyyy')
and to_date ('3/31/2007','mm/dd/yyyy')
and c.vendor=q.supplier
join glovia_prod.ven_loc v on v.vendor=c.vendor
-- from qa_occ q, glovia_prod.c_vencom@gl7test c, glovia_prod.ven_loc v
--where q.occdate between to_date('4/1/2006','mm/dd/yyyy')
-- and to_date('3/31/2007','mm/dd/yyyy')
and v.vendor='10143'
-- and v.vendor=c.vendor
-- and c.vendor=q.supplier
and v.ven_loc=c.pur_loc
and c.pur_loc=q.SUPPLIERLOC
group by v.name, c.commodity)
union
select '' as supname,commodity,ip from
(select v.name as supname, c.commodity, sum(q.indexpoints+q.lateindexpoints) as ip
from qa_occ q right outer join glovia_prod.c_vencom@gl7test c
on q.occdate between to_date('4/1/2006','mm/dd/yyyy')
and to_date ('3/31/2007','mm/dd/yyyy')
and c.vendor=q.supplier
join glovia_prod.ven_loc v on v.vendor=c.vendor
and v.vendor<>'10143'
group by v.name, c.commodity)
order by commodity, ip desc) qa
where qa.commodity in (
select commodity from glovia_prod.c_vencom@gl7test
where vendor='10143')
group by commodity,supname,ip
order by commodity,supname,ip

Similar Messages

  • Hoping for some help with a very frustrating issue!   I have been syncing my iPhone 5s and Outlook 2007 calendar and contacts with iCloud on my PC running Vista. All was well until the events I entered on the phone were showing up in Outlook, but not

    Hoping for some help with a very frustrating issue!
    I have been syncing calendar and contacts on my iPhone 5 and Outlook 2007 using iCloud  2.1.3 (my PC is running Vista). All was well until the events I entered on the phone were showing up in Outlook, but not the other way around. I’ve tried the usual recommended steps: deselecting calendar and contacts in the iCloud control panel and then re-selecting, signing out of the panel and back in, and repairing the Outlook installation in control panel.  I even uninstalled iCloud on the PC and downloaded it again (same version). 
    The furthest I’ve gotten is step 2 (and once, step 3) of 7 while performing “Outlook Setup For iCloud.” At that point I get, “Your setup couldn’t be started because of an unexpected error.”  After the first attempt at all this, all my calendar events disappeared from Outlook, although they are still in iCloud calendar and on my phone.
    Sound familiar?  Any ideas on how to solve this iCloud/Outlook issue?  Thanks much in advance!

    Hoping for some help with a very frustrating issue!
    I have been syncing calendar and contacts on my iPhone 5 and Outlook 2007 using iCloud  2.1.3 (my PC is running Vista). All was well until the events I entered on the phone were showing up in Outlook, but not the other way around. I’ve tried the usual recommended steps: deselecting calendar and contacts in the iCloud control panel and then re-selecting, signing out of the panel and back in, and repairing the Outlook installation in control panel.  I even uninstalled iCloud on the PC and downloaded it again (same version). 
    The furthest I’ve gotten is step 2 (and once, step 3) of 7 while performing “Outlook Setup For iCloud.” At that point I get, “Your setup couldn’t be started because of an unexpected error.”  After the first attempt at all this, all my calendar events disappeared from Outlook, although they are still in iCloud calendar and on my phone.
    Sound familiar?  Any ideas on how to solve this iCloud/Outlook issue?  Thanks much in advance!

  • Verizon iPhone 5, 64GB black - is anyone having issues with a very choppy conversation while talking on the phone.  Both my wife and I have the same phones and are both having the same issue.  We can only hear every other word.

    Verizon iPhone 5, 64GB black - is anyone having issues with a very choppy conversation while talking on the phone?  Both my wife and I have the same phones and are both having the same issue.  We can only hear every other word of the person we are talking to.  This happens at home, on the road and in the downtown area while calling both cellphones and landlines. It is intermittent, so we don't know exactly when it will reoccur.  Absolutely no problem with data.  The data speed is great.

    "Wireless devices use radio transmissions, so unfortunately you can't get Service if your device isn't in range of a transmission signal. And please be aware that even within your Coverage Area, many things can affect the availability and quality of your Service, including network capacity, your device, terrain, buildings, foliage and weather."
    Customer Agreement | Verizon Wireless
    While there may be an issue in your area, it is suggested that you don't use wireless service if it's a life or death situation, such as the one you've described.

  • TS2446 Hello, I'm Bethany and I'm having trouble with my apple ID I tried to buy something from he app store and they assed me some questions and anyway i have locked my account and don't know how to unlock any help with be very helpful thanks.

    Hello, I'm Bethany and I'm having trouble with my apple ID I tried to buy something from he app store and they assed me some questions and anyway i have locked my account and don't know how to unlock any help with be very helpful thanks.

    Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

  • I just bought an ipod touch 4th generation recently,found that it is very difficult to plug and unplug the USB cable from my ipod.Does anyone have this problem?

    I just bought an ipod touch 4th generation recently, found that it is very difficult to plug and unplug the USB cable from my ipod. Does anyone have this problem?

    Some of the Dock connector cables have very small buttons on the rounded adge of the plug, which need to be pushed in to release the plug from the iPod. Look at the picture below, do you notice the "button" on the white connector edge? There's one on the other edge too and they both need to be pressed in to release the "evil looking spike" sticking out of the grey edge.
    The shorter plugs (that I've seen) do not have the release mechanism, the plug simply pulls out.

  • Can I get help with podcasts?  When I try to open the podcasts, itunes crashes, says "itunes has detected a problem and must close", or the spanish equivalent since my xp is in spanish.  everything else works fine, it even downloads podcasts and syncs.

    Can I get help with podcasts?  When I try to open the podcasts tab, itunes crashes, says "itunes has detected a problem and must close", or the spanish equivalent since my xp is in spanish.  everything else works fine, it even downloads podcasts and syncs.

    The only other thing I can suggest is to use the Repair option for iTunes.
    Download the iTunes programme (do not uninstall your current iTunes) and then "install" the new copy. At some stage you should see an option to "install" or "Repair". Take the Repair option.
    Once you've done that, if you still have a problem, I don't know what else to suggest, except to search through the discussions to see if anyone else has had the problem and managed to fix it.

  • IPhone 5 screen is black, when I connect to ITunes it says "to allow access please respond to your Iphone". Impossible with a black screen, does anyone know what the prompt is?

    IPhone 5 screen is black, when I connect to ITunes it says "to allow access please respond to your Iphone". Impossible with a black screen, does anyone know what the prompt is?

    Hey 11doski,
    Thanks for the question. After reviewing your post, it sounds like the display has a dark screen. I would recommend that you read this article, it may be able to help you resolve or isolate the issue.
    iPhone: Hardware troubleshooting
    Display has no backlight or dark screen
    Toggle the ringer switch to see if the unit vibrates. If it does, it could be that iPhone is getting power, but is not displaying any image.
    Try turning iPhone off and then on again.
    While connected to the iPhone charger, try to reset the iPhone.
    If the low-battery screen appears, charge the iPhone.
    Thanks for using Apple Support Communities.
    Have a nice day,
    Mario

  • Ever since I updated my ipad2 and iphone5 to ios8, both devices are running slow, apps take forever to download (Google is STILL downloading on both), and they freeze/crash.  This is VERY frustrating!  Anyone else having the same problems?

    Ever since I updated my ipad2 and iphone5 to ios8, both devices are running slow, apps take forever to download (Google is STILL downloading on both), and they freeze/crash.  This is VERY frustrating!  Anyone else having the same problems?
    Message was edited by: Rkkshea

    Had same problem on my iPad2 with the original 8.0 release.  I ended up wiping it completely clean and doing a reset and restore from backup.  That seemed to fix my issues.  I had the same problem when 7 came out and did the same wipe and restore to get everything working well.

  • I need help with a PDF file that is an image, the "Read Out Loud' option does not work, please help!

    I need help with a PDF file that is an image, the "Read Out Loud' option does not work, please help!

    You mean an image such as a scanned document?
    If that is the case, the file doesn't contain any text for Reader Out Loud to read. In order to fix that, you would need an application such as Adobe Acrobat that does Optical Character Recognition to convert the images to actual text.
    You can also try to export the file as a Word document or something else using ExportPDF which I believe offers OCR and is cheaper than Acrobat.

  • How do I change the underlying query for the task board (and backlog board) on TFS Preview

    All,
    We work with multi-area projects, each area representing a significant component within the project with its own release/iteration cycle. i.e. Several areas may be active at once, each with different iterations.
    When we look at the task board these take no account of the area being worked on. What I need to do is to be able to change the query behind these boards to point to a particular release/iteration for a particular area.
    Unfortunately there is no drop down selection on these pages to see this automatically so I need to be able to change the underlying query that populates these boards to get the the area and release/iteration that I need.... but I can't find where these
    are.
    Using multiple areas is actually highly frustrating with TFS Preview as it doesn't seem geared up at all to make it easy to switch between them... are we doing something wrong?
    I think I can do this by changing the current iteration - but I can't work out how to do this either once an iteration for a particular area has started.
    Can anybody help?
    Thanks

    It is not possible to modify the query behind the task board. If I understand you correctly, you would like to filter the task board by area path.
    In TFS 2012 we have repurposed the area path field to be the field that determines the team you are working on. We are continuously improving our product and being able to filter your task is one of the improvements that we are thinking of.
    Sorry I can't help you better than this for the moment.
    Please remember to mark the replies as answers if they help.
    Hi Ewald,
    We have a similar problem, see the thread "Best approach for multi-team/multi-projects." on this forum. I'm hopping you can help, since so far the different answers doesn't help.
    Best Regards,
    SYSOTI

  • I just upgraded my iPhone 3GS to 4.3.5 and my universal doc stopped working with it?  It has worked flawlessly for the last year and suddenly I get the message: "this iphone is not optimized for this device."  The music comes out too quiet to the speakers

    I just upgraded my iPhone 3GS to 4.3.5 and my universal doc stopped working with it?  It has worked flawlessly for the last year and suddenly I get the message: "this iphone is not optimized for this device."  I dismiss the message, but the remote no longer works with it and the music is too quite to the speakers.  The remote works fine with my Macbook Pro.  I tried a restore on the iPhone and started from scrach, but the same problem exists.
    Any help with this?
    Thanks,
    JT

    yep... my iphone 4 also having problem like astoker.. u see on dock pin using torch light.. i found 2 pin touch each other.. i solve my problem ready.. thanks wjosten.

  • Query picking data for the running request

    Hi Guyz,
    Am working on BW 3.5,
    We run a query on a Multicube on daily basis, the scenario here is when we ran a query during one of the infocube load which was not activated and not ready for reporting (Request for reporting available symbol is missing), even then the query picked data for the request which was still running.
    Cheers!
    Ravi
    Edited by: Ravi Srinivas on Aug 18, 2009 1:20 PM

    Good to know that your doubts are cleared...
    For more information browse through SDN and have a look at these notes:
    Note 411725 - Questions regarding transactional InfoCubes
    Note 1063466 - Transactional request is not set to qualok
    Hope it helps...
    Regards,
    Ashish

  • I am thinking of getting my first Macbook pro for uni and was just wondering which one would be the best? The macbook pro or macbook pro with retina display? or even wait for the new release in 2013 ?

    I am thinking of getting my first Macbook pro for uni and was just wondering which one would be the best? The macbook pro or macbook pro with retina display? or even wait for the new release in 2013 ?

    If your budget is unlimited, look at both the retina and non-retina and make a decision based on your preferences.  If funds are tight, explore the options in the refurbished section.  Unless you are dealing with courses that demand specific performance parameters, any one of these options will suffice.
    Ciao.

  • HT1212 I found an iphone over one year ago. Its locked with a passcode. I kept waiting for the owner to call it. They never did. I went to ATT store today, they put a new sim card in it. but now itunes needs the passcode to reset it to factory settings.

    I found an iphone over one year ago. Its locked with a passcode. I kept waiting for the owner to call it. They never did. I went to an AT&T store today, they put a new sim card in it. and told me to go home, log on to itunes, and restore the phone to "factory settings".But itunes says the phone is locked and it needs the passcode to reset it to factory settings.
    Any workaround? Or, am I doing something wrong here?
    Thanks so much.
    Joe

    Sounds like you may be the owner of a new phone!  If you don't need or want it and no one claims it you probably can sell it. Check eBay to see what the going rate is.
    You are to be commended for at least trying to find the owner. Many wouldn't. 
    Best.
    GDG

  • When accessing the any tasks from Fusion Applications homepage, "An error was received for the task Manage Worker Goal Setting Lookups. This task is identified with the code HRG_MANAGE_WORKER_GOAL_SETTING_LOOKUPS that invokes program /WEB-INF/oracle/apps/

    We have installed HCM and CRM modules on Fusion Application 11.1.7 version.
    This is 2 node architecture ie IDM components installed in one node and Fusion components installed in another node.
    We are able to start the IDM components and Fusion components successfully, but when users are trying to access any task from Fusion application home page, they are getting the below error
    A portlet consumer error was received for the task Manage Worker Goal Setting Lookups. Report the error details to the following owning product Goal Management.
    An error was received for the task Manage Worker Goal Setting Lookups. This task is identified with the code HRG_MANAGE_WORKER_GOAL_SETTING_LOOKUPS that invokes program /WEB-INF/oracle/apps/fnd/applcore/lookups/publicUi/flow/ManageCommonLookupsTF.xml#ManageCommonLookupsTF of module code fndSetup. Review the consumer and producer logs for more details on this error.

    This may be related to the other issue regarding "FUSION_APPS_WSM_APPID-KEY" as the logs contains exceptions like:
    oracle.wsm.policymanager.PolicyManagerException: WSM-02081 : Failed to login to perform requested action.
    Please refer to document Fusion Application Service Account Password Expiration Causes Portlet Producer Errors (1486388.1) for steps on how to verify and set the password. There is also exception:
    javax.security.auth.login.FailedLoginException: [Security:090302]Authentication Failed: User FUSION_APPS_PROV_PATCH_APPID denied
    This is also likely caused by an expired password, please see Fusion Apps Servers Are Not Starting Up - Password Policy Error :9000: GSL_PWDEXPIRED_EXCP :Your Password has expired (1629927.1).
    Jani Rautiainen
    Fusion Applications Developer Relations
    https://blogs.oracle.com/fadevrel/

Maybe you are looking for

  • Help with an HTML file in Flash.

    Hi there. I'm attempting to import an html file into my flash document into a textfield on a movie clip. The text works fine, as does the css I have attached, but the <a> tag will not work. I've attached my Actionscript and HTML files in the hopes th

  • When I click on "rent" in the iTunes Store nothing happens.

    When I click on "rent" in the iTunes Store nothing happens. I am signed in with a current credit card number. Any ideas what I should do? Thanks!

  • General Stack Trace and Exception Question

    I hope this is the correct forum to post to ... well here goes... The Big Picture: I�m using the org.xml.sax package (along with their subsequent �helper� and �ext� packages) to parse huge XML files. Some references: DefaultHandler -> org.xml.sax.Def

  • Safari keeps crashing when typing words

    This problem exists till now since I installed Mountain Lion last year. It happens when I typing words in safari, for instance, using google search. Some of my friends said no such problem, so I assume that there is some thing wrong with my OSX, mayb

  • Can not connect to itunes store after update

    i did an update on my itunes now when i go to the store it says "itunes could not connect to the ituns store. make sure your network connection is active and try again". it has done this before when i did an update the last time