Trying to join sales numbers - having trouble
I'm very new to Sql. I'm trying to join two queries into one. They each work independently, but when I try to combine them I get duplication - the same part is listed numerous times. I know it's something simple, but I can't figure it out. Any help would be much appreciate.
Query #1 - Pulls sales for last 30 days*
(select sitecode, physical_warehouse, partno, sum(qty_used) as qty_used_1_month
from partsusage
where ((date_usage > add_months(trunc(sysdate), -1))
and (date_usage <= trunc(sysdate)))
group by sitecode, physical_warehouse, partno) SOLD
Query #2 - Lists the site, part #, and order type._
SELECT ORDER_PARTS.SITECODE_SUPPLIER as orig_sitecode_ship_from
, order_parts.partno
,order_header.order_sub_type,
FROM ORDER_HEADER, ORDER_PARTS
Queries combined:*
SELECT ORDER_PARTS.SITECODE_SUPPLIER as orig_sitecode_ship_from
, order_parts.partno
,order_header.order_sub_type,
FROM ORDER_HEADER, ORDER_PARTS
, (select sitecode, physical_warehouse, partno, sum(qty_used) as qty_used_1_month
from partsusage
where ((date_usage > add_months(trunc(sysdate), -1))
and (date_usage <= trunc(sysdate)))
group by sitecode, physical_warehouse, partno) SOLD
Looks like a lovely Cartesian join to me ... your WHERE clause contains filters but no joins.
Run the demos here:
http://www.morganslibrary.org/library.html
under joins and bookmark the library page for future reference.
Similar Messages
-
Just joined cloud computing having trouble accessing premier pro ...help please
just joined cloud computing having trouble accessing premier pro ...help please
Hi Jeff: thanks for getting back to me. My daughter was downloading
components but had downloaded the free demo last night. She
uninstalled what she thought was the demo but now we are unable to
access the Premier Pro component and no icon is present on the screenor
otherwise. This is our first time with a Mac so maybe we just don't
know where it is but are at a loss right now. Thinking I should
cancel my product purchase and then start from scratch if there is no
easy solution.
Your thoughts?
Duarte -
Can anyone help!!! I am having trouble sending only SMS messages to one number we have tried resetting our phones checking with our carriers turning off I message deleting each other's numbers but nothing is working please help
Hi there Iphone5nae,
I would recommend taking a look at the troubleshooting steps found in the article below.
iOS: Troubleshooting Messages
http://support.apple.com/kb/ts2755
-Griff W. -
I am having trouble getting a numbers spreadsheet to hold different formats in the same column. A column with a date formatted heading will not convert to $ for the cells below. Any suggestions would help.
Hi Wayne,
Thank you for this response. I have tried this but when I start enterring $ amounts some, such as $6.00, go in OK others such as $4.00 appear as a date ie 4 Oct 12.
Kind regards
Paul -
Phone numbers are no longer visible in my contacts and I'm having trouble syncing my contacts from my outlook contacts. Any suggestions for how to restore contacts?
Hi and Welcome to the Community!
I recommend that you attempt to boot into Safe Mode:
KB17877 How to start a BlackBerry smartphone in Safe Mode
It may take you multiple attempts to get the ESC key sequence (press/release/hold) correct, so be patient. When successfully into Safe Mode, see what happens.
If the behavior ceases, then think carefully...what happened just before this behavior started? A new app? An update? A Theme? Something else? Think carefully as the smallest change could be causal...and attempt to undo whatever that was.
But if the behavior continues in Safe Mode, then you may need to consider more drastic actions -- WIPE, OS Reload, BBSAK Wipe/Reload, and the "Bare Bones" OS Reload Process. To prepare, you should be sure that you have a full backup to your PC...please review the Backup link in my auto-sig on this post for instructions.
Good luck and let us know!
Occam's Razor nearly always applies when troubleshooting technology issues!
If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
Join our BBM Channels
BSCF General Channel
PIN: C0001B7B4 Display/Scan Bar Code
Knowledge Base Updates
PIN: C0005A9AA Display/Scan Bar Code -
I have been having trouble connecting to my wifi on my ipad mini but my iPod is just fine......it will connect and then say "Unable to connect to network" I've tried resetting my ipad mini and turning off my router for 30 seconds and its not working.
What TC do you have? Model number direct from the base is a big help, it will be A1 followed by 3 numbers.. eg
A1409 Gen 4.. The new AC is A1470
How is it setup?
I need the whole network setup. what modem/router, how is the TC connected etc??
I also need to know what IP the ipod gets, so I can see what mode the TC or network router is working in. -
Hi, I am having trouble getting an album to download. I have tried it on both my iPhone and laptop through iTunes but neither works. I am wondering if it could be the size of the album stopping it downloading (212 Tracks) Any Ideas?
These alerts occur due to timeouts or conflicts trying to write a file during download.
If you encounter this issue while while downloading something from the iTunes Store:
Delete your iTunes Downloads folder, located in:
Mac OS X: ~/Music/iTunes/iTunes Media/Downloads Note: "iTunes Media" may appear as "iTunes Music. Also, the tilde (~) refers to your Home directory.
After locating your iTunes Downloads folder:
Quit iTunes.
Delete the Downloads folder on your computer.
Open iTunes.
Choose Store > Check for Available Downloads.
Enter your account name and password.
Also review this support aticle as it might be causing due to internet connection: http://support.apple.com/kb/ts1368
Hope this helps. -
I am trying to share calendars with my husband (using Google calendars). He can see my calendars, but I am having trouble seeing his. We both use iPhones. We both have company email addresses. I have had to install and uninstall my gmail info on my iPhone multiple times due to errors sending and receiving emails from my company email address on my phone. For some reason, all of my emails are getting stuck in my outbox when my gmail account is installed on my phone. When I delete it, my emails get sent automatically. This is really annoying! I would do without the gmail account, but I need to share calendars with my husband. How do I fix this?
If you have two-step verification turned on in your email account, you'll have to log in with a browser and turn it off.
-
I am having trouble viewing iStore. It appears as if its a Flash issue, as several minutes after logging in to iStore I get a non-flash page of iStore in my iTunes window. I have re-installed everything and tried opening all ports in router, and used msconfig to bring up each service individually to see if there is an effect.Flash and iTunes have been re-installed ...any ideas?
I agree. I don't rely on iCloud as a backup, that is what I have my portable hard drive for. Its 500 GB so I can hold my entire iTunes library several times over on it. I have all my movies on my hard drive, but somehow "The Mist" got deleted off of my hard drive, so I figured "Well, the option to redownload an already purchased movie is available through iCloud, I'll just do that!"
And permissions and download availability have nothing to do with it, the movie's still there, it still allows me to redownload it. The only problem is when I click download, I get that message.
And nobody else uses my computer, but I do have multiple accounts authorized on it. Even still though, I am attepmpting to download it through the account I purchased it under. :/ -
I am having trouble with my Ipad. I am a windows user. It says that it hasn't been backed up in 2 weeks. I tried connecting to my laptop but nothing happens.
If you haven't already done so, try it by holding the on/off and home buttons at the same time until you see the Apple logo, then releasing.
-
I am having trouble send messages with attachments in Mail. Even small attachments (130K) Mail tries to send, then gives up and the message sits in my out box. How can I fix this?
1. You need an external DVD drive.
2. There are no Mac OS X applications or other software in the iTunes App Store.
(116312) -
HHi having trouble viewing a downloaded file from a site my iPad is telling me I don have a app to open file . And have downloaded loads of apps and still no joy . Have tried this on my android phone to and still nothing. Please can anyone help as slowly going crazy. Thanks tim
What type of file? From what site? What Apps have you downloaded for it?
Perhaps if you provide details of what you are doing we can provide more precise help. -
I have been having trouble with my iphone 4 for the past day . i tried to update it to 7.0.4 then the screen went blank and it keeps telling me to connect to itunes . I have connected it to 2 computers , using different cords and it doesnt recognize it . It says it is in recovery mode and i need to restore . after clicking restore it says that my iphone cannot be restored . I am very frustrated because i have been online searching for solutions all day and nothing seems to work . As soon as i turn on my phone it goes to the apple logo for about 2 seconds then the connect to itunes screen . SOMEBODY PLEASE HELP ! my phone is my life and i need it back on .
Connect the device to iTunes and restore from the most current backup.
If the issue continues, restore as new. -
Hi, I am having trouble updating my apps, I have tried one at time and all together but they just keep on whirring away and nothing happens! any ideas woud be appreciated.
Suggest you update all these apps on iTune (computer) and sync them to your iPad.
-
I'm having trouble with my Ipod- I tried to restore it but keep getting a message - the ipod could not be restored. an unknown error occurred(1413)
Mt computer has been freezing up on me lately and I think it messed up my Ipod when it quit right in the middle of downloading and got shut off.That's because you jailbroke your phone. You can't get help here.
Maybe you are looking for
-
How can I get Minecraft onto my Macbook Pro?
How can I get Minecraft onto my Macbook Pro? It is 15 inch Retina display, and it is Version 10.9.1 . I download the game, log in and press play, but as soon as it finishes loading, the blue bar goes away and nothing else happens! It goes from this:
-
I have problem in this unzip java codes
hi all,I have problem in this unzip java codes,I think either the pathway that i put C:.......is wrong or the codes are wrong because when i run it, the zipped folder is not unzipped. So anyone has another set of example or know how to correct it? Th
-
Hi Experts, I needed this bit of information about change pointers. Can someone please tell me how the column 'ALE processing indicator' in BDCPS table gets upadted? Also does BDCP and BDCPS table get updated simultaneousy whenever there is any cha
-
Hi What are topics involved in Interfaces,Conversions in ABAP?
Please Explain me. Thank u in advance
-
How to move track layer in timeline so all keyframes move together?
Hi all, I have a simple project with various text layers moving up from the bottom and gently landing in position. There is also a style face blur going on so the text starts out blurred and becomes clear as the text lands. As I duplicate a layer in