Group by help please
Oracle 11.2.0.1
Windows xp
create table cust(cust_id number,phone number,city varchar2(20),state varchar2(20),country varchar2(20));
insert into cust values (101,12345,'City1','State1','Country1');
insert into cust values (102,1114,'City1','State1','Country1');
insert into cust values (103,1214,'City2','State1','Country1');
insert into cust values (104,44414,'City2','State1','Country1');
insert into cust values (105,21454,'City2','State1','Country1');
insert into cust values (106,12546,'City1','State2','Country1');
insert into cust values (107,146,'City1','State2','Country1');
insert into cust values (108,44569,'City1','State2','Country1');
insert into cust values (109,26548,'City2','State2','Country1');
insert into cust values (110,96545,'City3','State2','Country1');
insert into cust values (111,945,'City1','State1','Country2');
SQL> select * from cust;
CUST_ID PHONE CITY STATE COUNTRY
101 12345 City1 State1 Country1
102 1114 City1 State1 Country1
103 1214 City2 State1 Country1
104 44414 City2 State1 Country1
105 21454 City2 State1 Country1
106 12546 City1 State2 Country1
107 146 City1 State2 Country1
108 44569 City1 State2 Country1
109 26548 City2 State2 Country1
110 96545 City3 State2 Country1
111 945 City1 State1 Country2
11 rows selected.Required output : (If I wish to get State=State1 and Country=Country1) Only any one row from each city of country1 and State1.
CUST_ID PHONE CITY STATE COUNTRY
101 12345 City1 State1 Country1
103 1214 City2 State1 Country1Required output : (If I wish to get State=State2 and Country=Country1) Only any one row from each city of country1 and State2.
CUST_ID PHONE CITY STATE COUNTRY
106 12546 City1 State2 Country1
109 26548 City2 State2 Country1
110 96545 City3 State2 Country1any row i.e. columns of the table group by country,state,city.
Thanks.
Analytic functions are essential if you use SQL professionally. Here, you can also use grouping though.
SQL> SELECT Max (cust_id) KEEP (DENSE_RANK FIRST ORDER BY cust_id) cust_id,
2 Max (phone) KEEP (DENSE_RANK FIRST ORDER BY cust_id) phone,
3 city, state, country
4 FROM cust
5 GROUP BY country, state, city
6 ORDER BY country, state, city, cust_id
7 /
CUST_ID PHONE CITY STATE COUNTRY
101 12345 City1 State1 Country1
103 1214 City2 State1 Country1
106 12546 City1 State2 Country1
109 26548 City2 State2 Country1
110 96545 City3 State2 Country1
111 945 City1 State1 Country2
6 rows selected.
Similar Messages
-
I am trying to send an email to a group which I have created in my contacts. I would like to hide the list of email addresses but cannot see how to do this. Can anyone help please?
Thank you for your message.
I can see how you do that when using the 'normal' emailing system from my mailing box, but not when working from the contact application (the 'book' on the bottom icon bar with the @ on it).... -
I cannor sync my contact groups from Outlook 2010 (Win 7) onto my iPad. Can anyone help please ?
in Itunes, once you connect the iPad, do you see the 'info' tab? Tap that and scroll down and see if outlook is chosen as the place to sync contacts from. If not, check it and sync and see if your contacts move over.
-
Need Urgent help please? I need to restore from a previous iphone backup.
Oops, I admit it - I messed up but need help please?? I received a replacement iphone today. My broken iphone OS and my itunes had the latest software updates and I did a full backup before going to the store to get the rerplacement. However, when I got home with the replacement iphone and plugged it in, it asked if I wanted to update the OS on it. I made the mistake of saying yes. It then made a backup of the empty factory settings from the new replacement and restored from that rahter than the backup I made before going to the store. Yes I know I should have said no and just did the restore which would have resotred my previous backup that I made before going to the store. Then after everything would be allright I could have told it to update the OS.
You can slap my in the face or I will do it myslef for making such a stupid mistake. All ready did the "I should have had a V" thing to my forehead.
After seeing the restore was fromthe factory settings rather than my earlier good backup, I went into my documents and drilled down to the mobile sync backup and saw that one of the three folders (with giberish as a title) has a lot of information with the date and time I did the backup before going to the store.
Could I possibly delete the later (factory setting backup) folder and then do a restore to get my good backup onto the iphone? I didn't do that yet in fear that it might mess something else up on the iphone and I wanted to check with you experts here first for guidance and assistance, PLEASE?
I'll be anxiously awaiting any help you can give!
Thank you!!rwmac22 wrote:
Hopt and OneOrangeTree, Thank you both very much for replying!!
It took me a long time to get back to the dissucison group because I tried both of your suggestions which therfore had to do about 4 restores. They take quite a while (about 50 minutes each actually). Your help got me half way there and is very apprecaited! I did manage (with your excellent help) to get most of my backup put onto the replaced iphone. the photos, music, and videos didn't get put over. I think I can move those back over by making sure they are selected in the seperate tabbed screens for the iphone. However, I can't get to those screens because every time I connect the iphone now, it brings up the "set up your phone screen". The one with the "an iphone has been previously synced with this compter" setup as new phone or restore from ....
Well I did the resotre from 3 times and that page still comes up when I plug in the iphone. Yes, I did close itunes, reboot the PC, and powered off the iphone and then brouhgt it back up before connecting (all several times), but itunes still takes me to the same "setup iphone screen".
Can you help me to get it to the standard iphone screen and there I will make sure the selected items are checked and do a sync.
Please know I do appreicate your kind assistance so far and hope someone can get me the rest of the way!
The "Backup" do not store your Applications, Music, Video's. It saves your settings, your application preferences, etc. -
WEBUTIL not working, some help please
Hi,
I am new to Forms 10G and I am starting conversion from Forms 6i. I think I have setup WEBUTIL as decribed in Oracle documentation, step by step. I noticed that none of the calls to WEBUTIL API's are working. For test I tried to delete a file by running: "client_host('cmd /c del c:\putty.log');"
It came back with error:
"oracle.forms.webutil.host.Host bean not found. WEBUTIL_HOST.Execute will not work."
What am I missing? Could anyone help please?
Thanks.I have done the following test:
1. Create new module
2. Add a block manualy
3. Add a button on the block
4. In the WHEN-BUTTON-PRESSED trigger add : "client_host('cmd /c del c:\putty.log');"
5. Attach webutil.pll removing the path
6. Compiled Ok
7. Executing the form returns the error mentioned above
than
8. Open webutil.olb object library from form builder
9. Double click on the MAIN tab
10. Drag the WEBUTIL object group under object groups node of my form subclassing it which added the following objects to my form:
a) WEBUTIL_ERROR under alerts node
b) WEBUTIL under data blocks node
c) WEBUTIL_CANVAS under canvases node
d) WEBUTIL under object groups node
e) WEBUTIL_HIDDEN_WINDOW under windows node
11. Compile OK
12. Works
Hope this helps,
Alex -
Help Please - e-mailing to a Category
I've set up a group of 14 addresses as a category. When I create a new e-mail and type the category name into the addressees all looks fine, but when I send the e-mail it's only sending to three of the addresses. Can anyone help please??
Hi MegaBuck,
Welcome.
What kind of email client are you using?
Stephanie
Stephanie
BTCare Community Manager
If you like a post, or want to say thanks for a helpful answer, please click on the Ratings star on the left-hand side of the post. If someone answers your question correctly please let other members know by clicking on ’Mark as Accepted Solution’. -
could sombody help please, my albums in my library are split in to individual tracks how can i merge them in to one album. many thanks
This web page can help you figure it out: http://samsoft.org.uk/iTunes/grouping.asp
-
My contacts have just totally disappeared. Can anyone help please.?
My contacts have just totally disappeared. Can anyone help please.? I'm using iPhone 4S
If you have itunes on pc or icloud than i think your contacts should be there.
Have you tried to sync to itunes (make sure to check Sync Contacts and all contact options on itunes info tab), activate the icloud account on your iphone's contact option and show all contacts on groups tab on iphone's contact app?
I experienced the same problem and this helped me. -
Select Union All - group by help
I have this Query with me
select Item_number , Total_Supplier_Qty, Total_Customer_Qty,Ship_from_org_name,inventory_item_id ,Total_onhand, min, max
from
select NULL AS Total_Supplier_Qty,sum(eoo.ordered_quantity) Total_Customer_Qty,
eoo.item_number Item_number,eoo.ship_from_org_name Ship_from_org_name,eoo.inventory_item_id
,Total_onhand, min,max
from eoo
group by eoo.item_number,eoo.ship_from_org_name ,eoo.inventory_item_id
UNION ALL
select eos.QUANTITY Total_Supplier_Qty,NULL AS Total_Customer_Qty,
eos.item_number Item_number,eos.Ship_from_org_name Ship_from_org_name,eos.inventory_item_id
,Total_onhand, min, max
from eos group by eos.item_number,eos.ship_from_org_name ,eos.QUANTITY ,eos.inventory_item_id
GROUP BY
Total_Supplier_Qty, Total_Customer_Qty,Item_number, Ship_from_org_name,inventory_item_id
,Total_onhand, min, max
order by Item_numbergiving me result
1901, - *,5* ,71317, 12, 4 ,6
1901 ,*6,* - ,71317, 12, 4, 6
I want result combined
1901, 6, 5, 71317, 12, 4, 6
Help please.select Item_number,
SUM(Total_Supplier_Qty) Total_Supplier_Qty,
SUM(Total_Customer_Qty) Total_Customer_Qty,
Ship_from_org_name,
inventory_item_id,
Total_onhand,
min,
max
from (
select NULL AS Total_Supplier_Qty,
sum(eoo.ordered_quantity) Total_Customer_Qty,
eoo.item_number Item_number,
eoo.ship_from_org_name Ship_from_org_name,
eoo.inventory_item_id,
Total_onhand,
min,
max
from eoo
group by eoo.item_number,
eoo.ship_from_org_name,
eoo.inventory_item_id
UNION ALL
select eos.QUANTITY Total_Supplier_Qty,
NULL AS Total_Customer_Qty,
eos.item_number Item_number,
eos.Ship_from_org_name Ship_from_org_name,
eos.inventory_item_id,
Total_onhand,
min,
max
from eos
group by eos.item_number,
eos.ship_from_org_name,
eos.QUANTITY,
eos.inventory_item_id
GROUP BY Item_number,
Ship_from_org_name,
inventory_item_id,
Total_onhand,
min,
max
order by Item_numberSY. -
Can't create see through text! Help please
I am very new to illustrator so please forgive me I am using CS4 on windows. I have followed all of the sugestions on this site (this is the exact effect that I am seeking!) and for the life of me none of it works.http://www.proficiografik.com/2010/02/08/building-a-hole-see-through-t ext-or-object-in-adobe-illustrator.html
So I am in search of help.I've worked in one layer, have tried a layer for the color box and another for the text, I have tried grouping the text box with the color box as well. I figure there is a step in the inital layout that I am missing, but I'm not sure. Help please!Lorranne,
When you have all three objects in the right order you should see:
A) The live Type (or outlined type) in black (san diego),
B) The intermediate shape, partly covered by the Type (the blue rectangle),
C) The image (the steely look).
Is that what you see? I see that.
If you select A) and B), by clicking or selecting in the Layers palette, what do you see in the Transparency palette?
If you then tick Make Opacity Mask, what do you see in the Transparnecy palette (both Clip and Invert Mask should be unticked), and what do you see on the Artboard?
Edit: Edited after seeing the video.
By the way, it makes no difference whether the image is embedded (as you mention) or linked. -
aperture 3.2.4, macbookpro lion: image disappears after loading from any project; repairing everything on starting app doesn't fix it. Only restarting the computer works. Any help, please? ... in non-technical language please. Thanks
“Hi Kirby, thanks a lot for your answer.
I got one answer, from DMoore, saying:
“Try Safe boot and then restart with only Aperture open. Still doent work write back with more details like Ram, HD capacity/free space. Are these thumbnails or Previews? Have you turned off building previews in AP preferances?
Safe boot http://support.apple.com/kb/HT1564
Starting up into Safe Mode does several things:
1 It forces a directory check of the startup volume.
2 It loads only required kernel extensions (some of the items in /System/Library/Extensions).
3 In Mac OS X v10.3.9 or earlier, Safe Mode runs only Apple-installed startup items (such items may be installed either in /Library/StartupItems or in /System/Library/StartupItems; these are different than user-selected account login items).
4 It disables all fonts other than those in /System/Library/Fonts (Mac OS X v10.4 or later).
5 It moves to the Trash all font caches normally stored in /Library/Caches/com.apple.ATS/(uid)/ , where (uid) is a user ID number such as 501 (Mac OS X v10.4 or later).
6 It disables all startup items and login items (Mac OS X v10.4 or later).
7 Mac OS X v10.5.6 or later: A Safe Boot deletes the dynamic loader shared cache at (/var/db/dyld/). A cache with issues may cause a blue screen on startup, particularly after a Software Update. Restarting normally recreates this cache.”
As I don’t know much about the technical aspects of computers, I don’t really understand the first answer, and it sounds like following it might produce unwanted changes.
But I understand your questions, so I’ll try to answer them;
"loading from any Project" means that I encounter the problem when I’m using a project, possibly after/because I’ve left the Mac on overnight, and/or I’ve made a lot of adjustments, and, once the problem is there, it happens in any other project which I open – the images load then disappear.
I can see images in the Browser, so it only happens in the Viewer(s).
I’m afraid I don’t understand what you mean by: “If you select "Photos" from near the top of the Library tab of the Inspector, does it show you all of your Images?”. I am a newcomer to Aperture, so I don’t know what some of the buttons are for yet, but when I want to look at and adjust my pictures, I import them, as referenced images, then Aperture creates a folder/project in the Library. When I click on that Project (when it’s working properly), all the images appear in the Browser or the Viewers – without me needing to “select Photos from near the top of the Library tab of the Inspector”. I selected it and looked at all the items in the dropdown menu, but none of them seems to offer the option to ‘show all the images’. So I’m not sure how to answer your question except to say that – yes, I can see all the pictures in the Browser or the Viewers (when it’s working properly), but I don’t seem to need to use the Photos button to achieve this.
Did Aperture work before?
Yes it worked ok for a while, but I only purchased it on 24th May.
If I understand correctly, the difference between thumbnail and preview is that the thumbnail is what I see when the “Loading” wheel is turning, and the disappearance of this wheel after a few seconds means that I am now looking at the preview (also, the thumbnail cannot be adjusted).
So I think the problem occurs when the thumbnail has finished loading; the viewer going blank/grey might mean that it is not showing the preview.
But I have not changed the default Preview settings in Aperture Preferences.
My macbookpro details:
2.7 Ghz Intel Core i7
Memory: 8 Gb 1333 MHz DDR3
Hard Drive capacity 499.25 GB
Available 387.36 GB
I have noticed another problem: I cannot apply the same rating to multiple images: following the instructions, I select a group of contiguous (or non- contiguous) images, choose a selection eg “5stars” using the keyboard, but the stars only appear in the last selected image – even though all the images are still showing as selected.”
I hope this helps you to understand more.
Thank you for trying to help me.
Tony -
Multiselect problem Help please!!
Hi all,
I am currently using Application Express 3.1.2.00.02 I have developed an online questionnaire with a multiselect list for one of the questions. The problem i am having is that i need each choice to be totaled up separately on the report generated.
My table of answers looks like this:
Column name e.g. (Question 9)
Answer "Dog" "Cat" "Mouse" "Snake" (underneath column name Question 9 depending on what is selected).
The reporting page would look like below:
*(Column Question 9)* Count
Dog 1
Mouse 1
Snake 1
and for the question you could have another respondent who chooses similar of items on the multiselect, so their answer looks like this:
Answer
"Question 9" Dog
"Question 9" Snake
This would then start a new row on the reporting page like below which is not what i want:
*(Column Question 9)* Count
Dog 1
Mouse 1
Snake 1
Dog: Snake 1
But the report should look like this:
*(Column Question 9)* Count
Dog 2
Mouse 1
Snake 2
The current SQLquery i am using is below:
select "QUESTION 9",
count(*) c
from "P1 DQUESTIONNAIRE"
group by "QUESTION 9"
Thanks for your help and suggestions,
'S'How to make sure your forum post will never be answered:
1) Make sure your subject line is completely meaningless (i.e. HELP PLEASE!) and describes no part of your actual problem
2) State that you are having "a few problems" but make sure to offer no details whatsoever what those problems are or what the symptoms are.
3) Post large volumes of code instead of distilling the problem down to a compact snippet
4) For extra points, make the code hard to read by refusing to make use of the "code" tag. -
I keep being asked to update my Safari but when I do a Software update it scans but never gives me a list and just says no new updates. Help please!
There are no updates to either OS 10.5.8 or Safari 5.0.6.
If you need a later version of Safari you must first upgrade your operating system to a later version of OS X. -
Please see my ? above: Im making an IMovie and need the last frame to just be text (can be on a color). I don't know how to go about doing this. Ive already done all my photos and captions. Need to have it ready for TOMORROW: Friday May 23rd. Help please!
ThanksYou can choose a background for the text from Maps and Backgrounds. Just drag a background to the end of the timeline, adjust to desired duration then drag title above it.
Geoff. -
I have a Bose soundtouch system .Until today I could play my iTunes music through it via air player . .I have just uploaded the latest upgrade from iTunes and now I am unable to connect to the Bose system . Can anyone help please? I can connect via my iPad and by using the Bose app so it is not the Bose at fault
@puebloryan, I realize this thread is a bit old, but I have encountered a similr problem and wondered if you had found a solution. I've been using home sharing from itines on my PCs for years, but two days ago, it suddenly stopped. I can share from my Macs, but not from the ONE PC library where I keep all my tunes. I tried all the usual trouble-shooting measures.
After turning home sharing off on the PC's iTunes, turning it back on and turning some other settings off and on, my Macs and Apple TV could briefly "see" the PC library, but as soon as I try to connect -- the wheel spins for a bit and then the connection vanishes. It's as if they try and then give up.
Since this sounds so similar to your problem, I was hoping you finally found a solution. I am also starting a new thread. Thanks!
Maybe you are looking for
-
How to navigate with the keyboard in album view?
Hello Is there a better way to navigate through the albums and then select/control tracks within an "open" Album in Album-View without using the mouse than what I am trying to describe below? iTunes is idle. switch to album view (shortcut to switch v
-
Work-around The Whine: why does this work? And is it BAD?
Hello everybody, sorry to bring up The Whine again, but I was wondering if anyone can figure out why the following trick works to eliminate the noise. Also, could doing this regularly (all the time, basically) potentially be bad for the system in any
-
Hi Gurus Can anyone help me on how to address bank term loan its periodic interest calulcation and payment etc., in SAP Regards Ganesh
-
Inconsistent Hasselblad .fff and .3fr loading ACR 5.4rc
hi all, i'm excited about the Hasselbald support in ACR 5.4, i've loaded the release candidate build from labs.adobe.com. Does anyone know whether ACR 5.4 is supposed to support both hasselblad .fff and .3fr files (and for that matter, both .fff's ma
-
JIN6 -A/R VAT is in Disable mode in the FTXP
Hi all, I defined new Pricing procedure by copying standard JFACT procedure for the new company code. In that I maintained JIN6 condition type for A/R VAT, same condition available in my tax procedure TAXINJ but when I go to maintain new Tax code thr