With the help of case condition for the date of distinct values is does not
Hello PL/SQL gurus and experts.I use Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64-bit Production version
I followed two tables
TT3-
create table TT3(FeesCntlr,CommCntlr,LatePayCntlr,Name,Age) as select
1,11,21,'Mike',25 from dual union all select
2,12,22,'Clark',26 from dual union all select
4,17,27,'Ussan',28 from dual union all select
5,13,21,'Linda',29 from dual union all select
6,14,24,'Obrek',35 from dual union all select
7,15,25,'Batty',45 from dual union all select
8,16,26,'Nicky',38 from dual;
TT4drop table TT4;
create table TT4(TRNID,BlockID,FeesCntlr,CommCntlr,LatePayCntlr,BookDate) as select
221,625,1,11,21,20121101 from dual union all select
223,625,2,12,22,20121101 from dual union all select
224,625,1,11,21,20121101 from dual union all select
225,627,4,17,27,20111001 from dual union all select
226,628,5,13,21,20120701 from dual union all select
227,628,6,14,24,20120701 from dual union all select
334,628,7,15,25,20120701 from dual union all select
339,629,8,16,26,20120701 from dual union all select
393,629,1,11,21,20120701 from dual union all select
432,629,2,12,22,20120701 from dual union all select
347,629,1,11,21,20120701 from dual union all select
556,629,4,17,27,20120701 from dual union all select
558,629,5,13,21,20120701 from dual union all select
974,629,6,14,24,20120701 from dual union all select
976,629,7,15,25,20120701 from dual union all select
980,629,8,16,26,20120701 from dual union all select
1223,650,2,12,22,20110415 from dual union all select
1224,650,1,11,21,20110415 from dual union all select
1225,650,4,17,27,20110415 from dual union all select
1226,650,5,13,21,20110415 from dual union all select
1227,650,6,14,24,20110415 from dual union all select
1334,650,7,15,25,20110415 from dual union all select
1339,710,8,16,26,20120115 from dual union all select
1393,710,1,11,21,20120115 from dual union all select
1432,710,2,12,22,20120115 from dual union all select
1347,710,1,11,21,20120115 from dual union all select
1556,710,4,17,27,20120115 from dual union all select
1558,711,5,13,21,20111231 from dual union all select
1974,711,6,14,24,20111231 from dual union all select
1976,711,7,15,25,20111231 from dual ;
Now, if I use the following DML for the year 2012, then the result is as follows-SQL> select t3.Name,t3.age,count(t4.TRNID),count(distinct(BlockID)) from
2 tt3 t3,tt4 t4
3 WHERE t3.feescntlr = t4.feescntlr
4 AND t3.commcntlr = t4.commcntlr
5 AND t3.latepaycntlr = t4.latepaycntlr
6 AND t4.bookdate between 20120101 and 20121120
7 GROUP BY t3.name, t3.age;
NAME AGE COUNT(T4.TRNID) COUNT(DISTINCT(BLOCKID))
----- ---------- --------------- ------------------------
Mike 25 12 3
Mike 27 12 3
Batty 45 4 2
Clark 26 6 3
Linda 29 4 2
Nicky 38 6 2
Obrek 35 4 2
Ussan 28 4 2
8 rows selected.
Now, if I use the following DML for 2011, then the result is as follows-SQL> select t3.Name,t3.age,count(t4.TRNID),count(distinct(BlockID)) from
2 tt3 t3,tt4 t4
3 WHERE t3.feescntlr = t4.feescntlr
4 AND t3.commcntlr = t4.commcntlr
5 AND t3.latepaycntlr = t4.latepaycntlr
6 AND t4.bookdate between 20110101 and 20111120
7 GROUP BY t3.name, t3.age;
NAME AGE COUNT(T4.TRNID) COUNT(DISTINCT(BLOCKID))
----- ---------- --------------- ------------------------
Mike 25 2 1
Mike 27 2 1
Batty 45 2 1
Clark 26 2 1
Linda 29 2 1
Obrek 35 2 1
Ussan 28 4 2
7 rows selected.
But by using the condition if I use the following dml and results do not match-SQL> select Name,Age,sum(Trn),sum(CurYrOrdr) "2011 Order", sum(LastYrOrdr) "2012 Order"
2 from
3 (
4 select t3.Name,t3.age,count(t4.TRNID) Trn,(case when t4.bookdate between 20110101 and 20111231
then count (distinct(BlockID)) else 0 end) CurYrOrdr,
5 (case when t4.bookdate between 20120101 and 20121120 then count (distinct(BlockID)) else 0 end)
LastYrOrdr
6 from
7 tt3 t3,tt4 t4
8 WHERE t3.feescntlr = t4.feescntlr
9 AND t3.commcntlr = t4.commcntlr
10 AND t3.latepaycntlr = t4.latepaycntlr
11 AND t4.bookdate between 20110101 and 20121120
12 GROUP BY t3.name, t3.age,t4.bookdate
13 )
14 group by Name,Age order by Name,Age;
NAME AGE SUM(TRN) 2011 Order 2012 Order
----- ---------- ---------- ---------- ----------
Batty 45 8 2 2
Clark 26 8 1 3
Linda 29 8 2 2
Mike 25 14 1 3
Mike 27 14 1 3
Nicky 38 6 0 2
Obrek 35 8 2 2
Ussan 28 8 2 2
8 rows selected.
As the expected output, that I expect - is----------------------------------
Expected Output -
NAME AGE "2012 TRNID" "2011 TRNID" "2012 ORDERID" "2011 ORDERID"
----- ---------- --------------- ----------------------------- ---------- ------------
Mike 25 12 2 3 1
Mike 27 12 2 3 1
Batty 45 4 2 2 1
Clark 26 6 2 3 1
Linda 29 4 2 2 1
Nicky 38 6 2 2 1
Obrek 35 4 2 2 1
Ussan 28 4 4 2 2
I sincerely thank each of you in advance for the input/comments that I fight with it for some time now.Kindly help.
user555994 wrote:
Hi JAC
Thanks for the comments and certainly once I comment out the following line.
- AND t4.bookdate between 20110101 and 20111120then the values are adapting, but at the same time why do we need to comment the date range condition as case is just a filter and not the condition.
filter should be-
AND t4.bookdate between 20110101 and 20121120 --"made it 12"
Tags: Database
Similar Questions
-
Remember - this is a public forum so never post private information such as numbers of mail or telephone!
Ideas: in my laptop is Explorer.exe does not load at startup on my account, his work with the guest account. Also it does not manually with the new process. Kindly help me.
I have seen at redistry Edit it's explorer.exe in winlogin sell attribute.
Hi HiteshAstan,
one) don't you recall making any changes to the computer before this happened?
(b) what exactly happens when you sign in to your account? You get a specific error message?
Step 1: Let us check if the problem persists in safe mode
Access the menu advanced startup options by turning on your computer and pressing the F8 key before Windows starts. In the advanced startup options select safe mode
http://Windows.Microsoft.com/en-us/Windows-Vista/advanced-startup-options-including-safe-mode
If the problem persists, you can deduct that the user account is corrupted
Step 2: Create a new administrator account and then try to repair your user account
Create-a-user account
http://Windows.Microsoft.com/en-us/Windows-Vista/create-a-user-account
Difficulty of a corrupted user profile
http://Windows.Microsoft.com/en-us/Windows-Vista/fix-a-corrupted-user-profile
After the back if you have any questions
Thank you, and in what concerns:
Ajay K
Microsoft Answers Support Engineer
Visit our Microsoft answers feedback Forum and let us know what you think.
-
I bought photoshop CS5 in 2011 and my laptop crashed and I bought a new one and had to re install the program. How can I do that I have my original email with the confirmation number ETC, but it does not appear on my order history?
Download from products of CS5 download
Install and enter your serial number.
-
I just ran the last update for my iPad and now it just continuously reboots to the black screen with the Apple Logo. I left plugged in all night and still no change. Hard restarting does not help, neither do not connect the unit to aMacBookPro. When I do this, iTunes complains that it can not connect because the iPad 'expires '. Now it is disconnected, but I can't turn it off. Even close the lid will not extinguish it. Any ideas?
Try the following. It seems yo may have to let the battery drain is completely:
- iOS: do not respond or does not light
-Also try DFU mode recovery mode post-test
How to put iPod touch / iPhone in DFU "Karthik doodles."
-If failed and that you cannot completely turn completely the iOS device, leave the battery to drain completely. After loading a hour repeat the foregoing.
-Try a different cable
-Try on another computer
S ' there is still not successful that usually indicates a hardware problem and an appointment at an Apple store Genius Bar is in order.
-
I installed photoshop CS4 on a new PC with the original CD.
Camera Raw does not show the 'Snapshots' tool and the tool "setting of the target".
Thanks for your help!
As you can see, you are using version 5.0, who can't stand still not instant in it.
Please check for updates in Photoshop > help.
Concerning
Sarika
-
After being on the phone with Adobe for more than an hour, I downloaded the creative cloud, with lightroom, photoshop and illustrator. It took about an hour to install the applications. Now my creative cloud does nothing when I click on it. It's just a blank white screen. I need to work for the school and have spent hours trying to figure it out. Help!
Try with the steps mentioned below:
N ° 1)
Launch the activity monitor and force them to leave Adobe all processes as creative cloud. CoreSync, AAMUpdater... etc.
Step 2)
(1) right click on the Finder icon and select 'Go - To Folder' option.
(2) you will get a text box, type in the following command and then press the 'return '. ("Not to be missed ~ symbol")~/Library
It will open the folder of the user's library.
(3) then navigate to Application Support > Adobe > OOBE. Open the OOBE folder and Opm.db bin file.
Once you had trashed Opm.db file, restart the Adobe Creative Cloud app and check.
Always the same?
Try steps mentioned in the link below:
-
I created a tab panel and applied some styles to tabs. (Drop shadow and change the stacking order so that each tab casts a shadow on that below.) Now everytime the page loads, it will default to the lower tab. The only suggestion that I've seen is to save and load the site with the desired tab is selected and 'active'. This does not seem to solve the problem.
Hmmm, have you looked into this widget from MuseGrid? It looks like roughly what it takes for this?
-
Problems with the .exe file programs + System Restore does not respond when you click
I have Windows Vista. This problem started a week ago. I tried at first to use my "ccleraner" already installed, but this program does not open when you click on it. I was asked to choose the program that the application to use to open it. This has also happened when clicking on itunes. My avast program when you click also asked which application is required to open it. When it finally scanned my system it does no propblems. In addition, I tried to turn on windows defendrer as he told me that it was off. Clicked on 'Turn on..' and nothing happened. Help!
Hello
See the following message to solve the problem of .exe if necessary once you are sure that the system is clean.
Try Mode safe mode with networking - repeatedly, press F8 that you start.
The best two methods allow scanners to run and/or AV.exe out of the way or removing.
1.
CTRL SHIFT ESC - task manager OR right click on the taskbar - task managerProcess tab - complete the process on AV. EXE and continue with the uninstall Guide.
If necessary use start - computer or Windows Explorer to navigate to
C:\Program Malwarebytes Anti - Malware\mbam.exe or where it is installed - if
necessary right click on the shortcut of Malwarebytes - Properties - tab - target line to see where it
is installed.Right-click on it and rename it to ZZMbam.COM (or something different than now), then
Double-click it and run it like this. You can rename it back later. Do the same with others
programs as needed. Use this method for other necessary - DO NOT ASSUMER one
program removes all or that there is no other malware.---------------------------------------------------
2.
Another method is to use them:Use Process Explorer to "Suspend" the process will not stop
Then use AutoRuns to delete the malicious program startup items.
Now use UnLocker to delete the files in the malware.
You may need to do a file at a time.
Process Explorer - free
http://TechNet.Microsoft.com/en-us/Sysinternals/bb896653.aspxAutoRuns - free
http://TechNet.Microsoft.com/en-us/sysinternals/bb963902.aspxUnLocker - free (do not install the adaware Ebay)
http://www.Softpedia.com/get/system/system-miscellaneous/unlocker.shtmlAV.exe
==============================================
There are MANY varieties of these with many names, but all can be eliminated with the same methods:
Win 7 Antispyware 2010 XP Internet Security 2010 and Vista Antivirus 2010 is rogue antivirus.
scams to get you to pay for them while they have no advantage at all.How to remove all THE varieties of this malware - please read carefully the removal Instructions.
http://www.bleepingcomputer.com/virus-removal/remove-antivirus-Vista-2010RENAME this as necessary to allow them to perform: (use a different name with the extension .COM instead of .exe)
It can be made repeatedly in Mode safe - F8 tap that you start, however, you must also run the
in the regular when windows you can.Download malwarebytes and scan with it, run MRT and add Prevx to be sure that he is gone. (If Rootkits
UnHackMe execution)Download - SAVE - go to where you put it-right on - click RUN AS ADMIN
Malwarebytes - free
http://www.Malwarebytes.org/Run the malware removal tool from Microsoft
Start - type in the search box-> find MRT top - right on - click RUN AS ADMIN.
You should get this tool and its updates via Windows updates - if necessary, you can download
here.Download - SAVE - go to where you put it-right on - click RUN AS ADMIN
(Then run MRT as shown above.)Microsoft Malicious - 32-bit removal tool
http://www.Microsoft.com/downloads/details.aspx?FamilyId=AD724AE0-E72D-4F54-9AB3-75B8EB148356&displaylang=enMicrosoft Malicious removal tool - 64 bit
http://www.Microsoft.com/downloads/details.aspx?FamilyId=585D2BDE-367F-495e-94E7-6349F4EFFC74&displaylang=enalso install Prevx to be sure that it is all gone.
Download - SAVE - go to where you put it-right on - click RUN AS ADMIN
Prevx - Home - free - small, fast, exceptional CLOUD protection, working with other security programs.
It is a single scanner, VERY EFFICIENT, if it finds something to come back here or use Google to see
How to remove.
http://www.prevx.com/ <-->-->
http://info.prevx.com/downloadcsi.asp <-->-->Choice of PCmag editor - Prevx-
http://www.PCMag.com/Article2/0, 2817,2346862,00.aspTry the demo version of Hitman Pro:
Hitman Pro is a second scanner reviews, designed to save your computer from malicious software (viruses,
Trojan horses, rootkits, etc.). that has infected your computer despite all security measures that you have
taken (such as the anti-virus software, firewall, etc.).
http://www.SurfRight.nl/en/hitmanpro--------------------------------------------------------
If necessary here are some free online scanners to help the
http://www.eset.com/onlinescan/
http://OneCare.live.com/site/en-us/default.htm
http://www.Kaspersky.com/virusscanner
Other tests free online
http://www.Google.com/search?hl=en&source=HP&q=antivirus+free+online+scan&AQ=f&OQ=&AQI=G1--------------------------------------------------------
Also do to the General corruption of cleaning and repair/replace damaged/missing system files.
Run DiskCleanup - start - all programs - Accessories - System Tools - Disk Cleanup
Start - type this in the search box-> find COMMAND at the top and RIGHT CLICK – RUN AS ADMIN
Enter this at the command prompt - sfc/scannow
How to analyze the log file entries that the Microsoft Windows Resource Checker (SFC.exe) program
generates in Windows Vista cbs.log
http://support.Microsoft.com/kb/928228Run checkdisk - schedule it to run at the next startup, then apply OK then restart your way.
How to run the check disk at startup in Vista
http://www.Vistax64.com/tutorials/67612-check-disk-Chkdsk.html-----------------------------------------------------------------------
If we find Rootkits use this thread and other suggestions. (Run UnHackMe)
I hope this helps.
Rob - bicycle - Mark Twain said it is good.
-
Hello
I want centered vertically align something (for example, a label) on a page with the qml following, but it is not aligned properly on the keyboard BB (720 x 720), it aligns on the contrary always on top. It aligns not centered vertically as expected on BB 10 all touch (1280 x 768).
import bb.cascades 1.0 Page { titleBar: TitleBar { title: "Title" } Container { layout: DockLayout { } background: Color.create("#444444") verticalAlignment: VerticalAlignment.Fill Label { text: "label" verticalAlignment: VerticalAlignment.Center } } }
I realize also realize that if I remove the title bar, and then it snaps as I want. Anyone have a solution this? Thank you.
Try with this:
titleBar: TitleBar { title: "Title" scrollBehavior: TitleBarScrollBehavior.Sticky }
-
I have a problem with the gamepad Gold master 350 gp does not not on Windows 8.
Original title: program Uyumluluk General Uygulamalar Programlar
I have a gamepad is goldmaster gp350... It is a usb gamepad... He was working on win7 or vista... But does not work on win8... Productor web site there is no driver for win8... It is only for win7 driver and former windows product... I tried the compatibility program win8 solution but no success... Please a solution...
Hello
Sorry, this forum is in English only.
Please select the language icon at the bottom of this page English and select your native language from the popup list to view the forums in the language of your choice.
If you can't find the language of your choice, support for international sites additional options can be found by clicking on the following link:
http://support.Microsoft.com/common/international.aspx
Concerning
-
trial LR 6 cc import goes well with different cards, that one card does not work, usb HDD with only images, map 9571 115GB, sometimes only 300 photos pics, then wait all night nothing, try separate subfolders, only two subfoldrs(including subfolder) done well, 175, and 125 peaks, other subfolders doesnot work, opendLR as administrator : no difference. I7 import about 60-70%. on the import of only about 300 visible pictures, the other empty square. solution?
Hi willemm,
first instance LR 6 cc import goes well with different cards, that one card does not work.
Could you please develop the issue you are facing?
What is the image format you import?
USB HARD drive with only images, card 9571 115GB, sometimes only 300 photos pics
I would not recommend to import gb 115 library at once.
Kind regards
Assani
-
Must be hyperlink with the tracking code of project edge, does not
I used the URL to test inserted on the invisible elements "hot spot" in my animated project of edge that have been opening up fine in the browser. Now I need to update these URLs with the path of the syntax, but when I change sides (replace the URL in the control panel actions of this element) and then run the animation in the browser, the link does not open.
Any ideas or suggestions?
Too bad, the URL itself had quotes which needed to be removed; Once this has been done the URL is opened correctly.
-
Order of the data rows of Gantt chart does not match the order of the lines in the timeline
Hello
I have a project with tasks parent and child gantt chart. It works fine except that the order of the rows in the datagrid control does not always match the order of the lines in the timeline. If it should not match? In addition, in the timeline, in some cases the period of the child does not appear directly under the parent period. Is this a bug or am I missing something? How to get the lines in the correct order?
Tiina
Published by: Tiina on 11.11.2010 01:08Tiina salvation,
Thank you update data, which solved one of the questions. Now for the actual order of the elements in the timeline - if you take a look at the order of the data in the XML table, calendar entries are just that reflects the order in which the data was returned by the query. So although I suggested using an ORDER BY ID condition on your request, you are actually better off using a START WITH... CONNECT BY clause for resultset hierarchical of output.
I created 2 page in your application (a copy of page 1), where you can compare the difference between the paintings pages 1 & 2, in terms of appearance and also the order of the tasks in the XML file.
I hope this helps.
Kind regards
Hilary -
Problem with the key... Button does not
My workflow is like this... I took three HoriZontalManager an organization theBackgroundImage the button and two HoriZontalManager to the CustomButton and I am adding the main hfm who hold the button and the background image at the top and then I added the list in a VerticalfieldManager but I don't get the button work the focus always remains in the field list. Now when I click on the update button always resides on the first line of the field list , so it always shows me the selector which is actually I set up on the first line of listfield. How can I solve this...
Thanks in advance...
Help, please.
Solved the problem, I had to check that if the button has the focus, then do the work remains the Listfield has focus. So just check
In the {navigationClick (int hour, int status)
{if (Button.isFocus ())}
Get the job done
} else {}
Field list is selected
}
}
Thank you all for your concerns...
-
I did the text in a version of the phone in a greater than the desktop version font size. But some will have to expand more. I was hoping it would be possible, because when you are viewing a version of office on the phone. Is it not a Muse capacity?
As I passed by Muse 'sites of the day', most of the sites were not extensible on the phone. However, themarketaustin.com and movingcolour.tv are extensible. What is the trick to this? I have a disappointed client who was expecting this ability.
The problem came from the menu bar in the masterpage.
When I remove it... Zoom/sleeve is available.
A menu made from the ToolTip widget is currently working with zoom/sleeve.
A "blank publication" widget is currently serving as a set menu.Although I have not tested carefully, I believe that the problem came from some "scrolling attributes" applied to the menu rest of the desktop version...
Maybe you are looking for
-
Pavilion 22cwa: HP Pavilion 21.5 inch IPS LED HDMI VGA Monitor
Hello I have recently bought HP monitor connected to my laptop and installed the driver. My only problem is the annoying icon on the upper right of my screen. It seems that it is a characteristic of the pilot. it disappears when I step outside, but w
-
HP Envy 5540: Printer Hp Envy 5540 randomly printed the Network Configuration Page
Hello! I bought this printer about a month ago. Set up the connection to the printer wireless with my wifi, and my understanding is that the printer is protected like my wifi and use the same password in order to print something. I kept my printer co
-
Graphics card does not not on my Hp Elite 7300 series MT
Hello I have a desktop HP Elite 7300 series MT with the following specifications: Card mother Pegatron IPISB-CH2 Core i5 2500 3.3 GHz 6 GB of DDR3 Ram Gigabyte Superb e620 PSU I just bought a powercolor HD7950 PCS + graphics card, but it did not work
-
I get the popup registration acer... I am registered and do not want it are constantly emerging. There is none program to start it. I tried Google, but responses were told to go to the start. I guess I'll get warreg_popup.exe if I can find it and di
-
I "lost" my screen about 1/2 in. in the right margin and about 1 inch down. May not know how to get it "centered" back on the moitor? Thank you.