Date Sorting - Please help
Sir,
I have a requirement.
Table :Price
Columns : Price_id
LOCK_EXPIRE_DATE
RELOCK_EXPIR_DATE
LOCK_EXTEN_EXPIR_DATE
I want to sort based on
LOCK_EXPIRE_DATE, RELOCK_EXPIR_DATE,
LOCK_EXTEN_EXPIR_DATE
eg:
Price_id | LOCK_EXPIRE_DATE | RELOCK_EXPIR_DATE | LOCK_EXTEN_EXPIR_DATE
19 | 12-12-2006 | NULL | NULL
15 | NULL | 15-12-2006 | NULL
14 | NULL | NULL | 11-12-2006
After sorting the above data should come like this,
14 | NULL | NULL | 11-12-2006
19 | 12-12-2006 | NULL | NULL
15 | NULL | 15-12-2006 | NULL
regards
Mathew
Suppose the table contans more than 1000 rows, this method will become difficult.I don't understand. Did you want to sort or not ?
1000 rows is nothing...
Here an example with my more 70000 objects... order with nvl or coalesce or without any function, oracle run a FTS.
SQL> drop table tbl_dt ;
Table dropped.
Elapsed: 00:00:00.02
SQL> create table tbl_dt (price_id number,LOCK_EXPIRE_DATE date,RELOCK_EXPIR_DATE date,LOCK_EXTEN_EXPIR_DATE date);
Table created.
Elapsed: 00:00:00.00
SQL> insert into tbl_dt
2 select rownum,
3 decode(sign(dbms_random.random),1,null,sysdate+rownum),
4 decode(sign(dbms_random.random),1,null,sysdate+rownum),
5 decode(sign(dbms_random.random),1,null,sysdate+rownum)
6 from dba_objects;
70882 rows created.
Elapsed: 00:00:16.05
SQL>
SQL> select price_id, LOCK_EXPIRE_DATE,RELOCK_EXPIR_DATE,LOCK_EXTEN_EXPIR_DATE
2 from tbl_dt
3 where rownum<15;
PRICE_ID LOCK_EXP RELOCK_E LOCK_EXT
1 20/01/07
2 21/01/07 21/01/07 21/01/07
3 22/01/07
4 23/01/07
5 24/01/07 24/01/07
6 25/01/07 25/01/07
7 26/01/07
8
9 28/01/07
10
11 30/01/07
12 31/01/07 31/01/07
13 01/02/07
14 02/02/07 02/02/07
14 rows selected.
Elapsed: 00:00:00.00
SQL>
SQL> set autot traceonly explain stat
SQL> select Price_id, LOCK_EXPIRE_DATE, RELOCK_EXPIR_DATE, LOCK_EXTEN_EXPIR_DATE
2 from tbl_dt
3 order by LOCK_EXPIRE_DATE,RELOCK_EXPIR_DATE,LOCK_EXTEN_EXPIR_DATE;
70882 rows selected.
Elapsed: 00:01:14.03
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 SORT (ORDER BY)
2 1 TABLE ACCESS (FULL) OF 'TBL_DT'
Statistics
135 recursive calls
137 db block gets
241 consistent gets
943 physical reads
0 redo size
1677989 bytes sent via SQL*Net to client
33351 bytes received via SQL*Net from client
4727 SQL*Net roundtrips to/from client
2 sorts (memory)
1 sorts (disk)
70882 rows processed
SQL> select Price_id, LOCK_EXPIRE_DATE, RELOCK_EXPIR_DATE, LOCK_EXTEN_EXPIR_DATE
2 from tbl_dt
3 order by nvl(LOCK_EXPIRE_DATE,nvl(RELOCK_EXPIR_DATE,LOCK_EXTEN_EXPIR_DATE));
70882 rows selected.
Elapsed: 00:01:14.06
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 SORT (ORDER BY)
2 1 TABLE ACCESS (FULL) OF 'TBL_DT'
Statistics
0 recursive calls
104 db block gets
228 consistent gets
1138 physical reads
0 redo size
1624623 bytes sent via SQL*Net to client
33351 bytes received via SQL*Net from client
4727 SQL*Net roundtrips to/from client
0 sorts (memory)
1 sorts (disk)
70882 rows processed
SQL>
SQL> select Price_id, LOCK_EXPIRE_DATE, RELOCK_EXPIR_DATE, LOCK_EXTEN_EXPIR_DATE
2 from tbl_dt
3 order by coalesce(LOCK_EXPIRE_DATE,RELOCK_EXPIR_DATE,LOCK_EXTEN_EXPIR_DATE);
70882 rows selected.
Elapsed: 00:01:14.05
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 SORT (ORDER BY)
2 1 TABLE ACCESS (FULL) OF 'TBL_DT'
Statistics
0 recursive calls
104 db block gets
228 consistent gets
1137 physical reads
0 redo size
1624624 bytes sent via SQL*Net to client
33351 bytes received via SQL*Net from client
4727 SQL*Net roundtrips to/from client
0 sorts (memory)
1 sorts (disk)
70882 rows processed
SQL> Nicolas.
Similar Messages
-
i recently have ipad but before i sell it i made a back up of it and by an iphone when i put all the date on my iphone some files and software did not install is there anything i can do to recover the lost data? please help
I don't think you're on iOS 5, I think you're using iOS 6. That's the latest version.
Unless you've used iCloud to back up your documents, you won't be able to restore them. And for future reference, you don't have to uninstall Pages to update your iPad anymore. Sorry about this. -
hello, okay? since then, was robbed today, and my find my
iphone this down, please tell me if he has a way to locate the computer, I need the iphone again, it has many important data it please help meIt's gone and you most likely are not getting it back.
If you had important info on it, you should have made backups so you would not lose the data. -
I ordered an iphone 6 plus 64 gig space gray on 9/19/14. I still have not gotten any information on the ship date. Please help verizon!!!
urdea123,
You called and help has arrived. Congrats on the new phone. The iPhone 6 Plus 64GB space gray device is shipping on 11/7. You can always check your order here http://vz.to/1qKj0Rx
RobinD_VZW
Follow us on twitter @VZWSupport -
Just installed OS Yosemite, and now I can't open Illustrator CS6. Asks me to update my Java, but I check and my Java is up to date. Please help!
Some people have reported reinstalling the Apple 2014-001 Java update has helped.
See thread 7 here Illustrator CC 2014 crashes on startup after Yosemite 10.10 upgrade today. -
I don't have wifi connection.I need to update my software to ios 8.0.2 using cellular data.How can I download using cellular data?.Please help.
There are often places to go which have free WiFi ie coffee shops, shopping malls, fast-food places.
You can connect the phone to your computer & download/update via iTunes if you have one. -
I am using Iphone 4S and Ipad 2...it seems that my App Store application is missing or deleted. How can i retrieve it? How do I download a new one. My software is up to date. Please help asap. Thank you.
Check: Settings - General - Restrictions - Installing Apps = ???
-
Need help with query that can look data back please help.
hi guys i have a table like such
CREATE TABLE "FGL"
"FGL_GRNT_CODE" VARCHAR2(60),
"FGL_FUND_CODE" VARCHAR2(60),
"FGL_ACCT_CODE" VARCHAR2(60),
"FGL_ORGN_CODE" VARCHAR2(60),
"FGL_PROG_CODE" VARCHAR2(60),
"FGL_GRNT_YEAR" VARCHAR2(60),
"FGL_PERIOD" VARCHAR2(60),
"FGL_BUDGET" VARCHAR2(60)
)and i have a data like such
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','1','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','0');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','14','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','2','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7470','4730','02','10','2','200');I bascially need to get the total of the budget column. however its not as simple as it sound(well atleast not for me.) the totals carry over to the new period. youll noticed the you have a period column. basically what im saying is that
fgl_grant_year 10 period 1 = for account 7600 its $100 and $100 for period 2 you see 100 dollars again this is not to be added this is the carried over balance. which remains $100.
so im trying to write a query that basically does the following.
im given a period for the sake of this example lets say period 1 i get nothing else. I have to find the greates grant year grab the amount for period 14(which is the total from the previous year) and add it to the amount of the current period. in this case period 1 grnt_year 11
so the expected outcome should be $700
240055 240055 7240 4730 02 10 14 200
240055 240055 7600 4730 02 10 14 100
240055 240055 7600 4730 02 11 1 400keep in mind that im not given a year just a period.
any help that you guys can offer would be immensely appreciated. I have been trying to get this to work for over 3 days now.
finally broke down and put together this post
Edited by: mlov83 on Sep 14, 2011 8:48 PMFrank
wondering if you can help me modify this sql statement that you provided me with .
table values have been modified a bit.
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','00','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','0');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7200','4730','02','10','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7600','4730','02','10','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','14','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','2','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','11','2','600');i need to take one more thing into consideration. if the greatest year has a value on period 00 i need to ignore the period 14 and the current period total would be
the current period +(current period - greatest year 00)
hope that makes sense so in other words with the new data above. if i was querying period two of grant year 11. i would end up with $800
because the greatest year is 11 it contains a period 0 with amount of $400 so my total should be
period 2 amount $ 600
period 0 amount $ 400 - period 2 amount of $600 = 200
600+200 = $800
if i query period 1 of grant 360055 i would just end up with 800 of grnt year 10.
i have tried to modify that query you supplied to me with no luck. I have tried for several day but im embarrased to say i just can get it to do what im trying to do .
can you please help me out.
Miguel -
To get the transaction data..please help
Hi all,
i need to retrive the transaction datas..like deleted ,n updated datas..
I tried this query
SELECT * FROM FLASHBACK_TRANSACTION_QUERY WHERE TABLE_OWNER='CFMSDEV'
AND TABLE_NAME='M_REGIONS'
but this is givng the feilds of details..not showing a fied what data is translated..
please help me...
thnks®ardsHi,
To my knowledge this can be achieved only by Change Data Capture in 10g.
Let us wait for others opinion.
Regards
K.Rajkumar -
I have an Apple Configurator install that wont recognize an iPad when I attach it via USB. I cant prepare it or refresh it. It was supervised. I get an error message that says "policy does not have correct profile data". At some point there was a mismatch between the profile on the iPad and the MAC server. The profile on the MAC server has been deleted and the iPad has been erased and reset to default. I need to be able to get Configurator to recognize this device to prepare it for deployment and issue Apps to it. Please help!!
Run the application 'Terminal.app' which you will find in '/Applications/Utilities' on your Macintosh.
Type this into it: defaults delete com.apple.configurator PreprationSavedPolicyDefaultsKey
Hit the return key.
If you get no error message, it worked, and you can quit the app. -
I have tried many solutions including chatting with a Adobe Support person and he couldn't fix it. Ive uninstalled everything using the cleaner several times and oh so much more. When i open Creative Cloud, the home page will not come up including the fonts page and behance and the apps page doens't have all the apps its supposed to have plus! their all out of date! i keeping getting the old verions. cs6. i have no option for CC. and even when i install them half of them don't work. the ones i wanted the most. since day one of purchasing creatice cloud ive been having errors and just a little bit ago the techinal support dude told me to click this link and go from there. the link was NO help at all!!!
I bought a product i can't even use and i'm getting very fustrated and mad. ive been trying to fix this problem for days! please help me!if you put it in boot-loader mode where it display the usbplug on the ipod touch screen as described in my link
and connect it and itune don't react by wanting to restore it's firmware
there is
1. something wrong with itunes reinstall it
2. something wrong with usb drivers on the computer reinstall them
3. something wrong with the usb port try another
4. something wrong with the cable try another
5. something wrong with the computer try another
6. something wrong with the connector in the button of the ipod touch RMA it -
HT1386 Trying to Sync - Unable to load data class - please help
I just cleared my I-Pod Touch to put new music on it and my computer is prompting the following. "I-Tunes was unable to load data class information from sync sevices." Reconnect of try again later. Another prompt that keeps appearing is "the application apple mobile device help quit unexpectedly." Please help me...
Apple Mobile Device Restart. Disable all security software ex. Firewalls and Antivirus. Follow article http://support.apple.com/kb/TS1567 . The above listed article is correct by lllaass. I resolve it by unchecking the different categories in itunes sync pages... Plug in device, click on name on left side of itunes, Click on different sync pages like summary, info, music, movies, etc. You need to uncheck the main check box to sync content. An example would be unchecking "Sync Music" . You will then need to sync once for each category until you locate the source of your corrupt files or folders. Syncing without it checked removes content from device. Follow this step even if there is nothing on the device. Once you identify if it is picture or music etc. you will need to delete corrupt files or move them somewhere else on the computer so itunes can't find it anymore.
-
Sql query for quarter data..Please help
Dear Experts,
Please help with this query...
i have data like below:
Year
Quarter
MRR
MRR%
2012
Q1
10
Q2
30
Q3
50
Q4
60
2013
Q1
20
Q2
30
Now i need to caluclate MRR % column values as below
for 2012 Q2 MRR % = (Q2MRR-Q1MRR)/Q1*100 that is (30-10)/10*100
for 2012 Q3 MRR % = (Q4MRR-Q3MRR)/Q2*100
for 2012 Q4 MRR %= (Q1MRR-Q4MRR)/Q1*100 here q1 of 2013 and q4 of 2012...
like this it wll go on..
Please help with me query compute values in MRR % column.
Best regards
aspMaybe NOT TESTED! No Database at hand
select year,quarter,mrr,
ratio_to_report(q_mrr) over (partition by year order by quarter) pct_mrr
from (select year,quarter,mrr,
mrr - lag(mrr,1,0) over (partition by year order by quarter) q_mrr
from t
Regards
Etbin -
Hi
I have updated my iphone 4s, with the new iso7. Now i can't find how to switch on the cellular data, please help!! Can't find the option in SettingsSettings>cellular>cellular data
-
HELP! Today's upgrade wiped out patient data! PLEASE HELP!
Please help... installed whatever was "new" today... just went to iCal to check my patients for tomorrow and... it's all gone!
The "new" iCal is arranged differently too... on my "calendars" I now have at least 2 if not 3 of every calendar I've ever created (yet none of them have the lost data). Have tried going back to IMPORT and/or RESTORE data and... it either hangs up or there's nothing to select (it's grayed out and the CHOOSE button never illuminates).
As a practicing psychologist I've now lost ALL my patient information, past and present! PLEASE HELP!
Thanks.
Dr. PetersonHope this helps. (and always have a backup file ready for a pull of any archived library files if any data is lost on an upgrade)
http://www2.tbo.com/content/2008/feb/25/bz-apple-fix-removes-ical-schedules/?new s-money
Maybe you are looking for
-
I am an absolute beginner to iMovie (2 Days) and though I found it fairly user friendly when I tried to export my video I got this.......MOV (Quicktime) or .WMV (Windows Media Video) video files ????? I think I need to convert but I don't know how. H
-
PowerMac won't sleep automatically unless a DVD is inserted
I have a rather strange issue with my G5 - even though I have selected "Put the computer to sleep when it is inactive for 5 minutes" in System Preferences/Energy Saver, my computer never sleeps. However, when I have a DVD in the tray, the computer sl
-
I'm evaluating both trial versions of Aperture 3 and Nikon's Capture NX 2. I shoot with a Nikon D90, and I'm trying to develop a consistent workflow which might use the best features of both Aperture 3 and Capture NX 2. I also tend to shoot a lot of
-
What product is good for screen protection without sticky stuff?
We just bought an iPhone 4S and want to keep the screen free of scratches and smudges. The HD film they sell in the store says it has an adhesive. Won't this mess up the screen? Any other suggestions?? Thanks!
-
How to delete music shortcut in Finder toolbar?
I accidentally added this music shortcut somehow, and I want to delete it. How do I delete the shortcut (not the actual music folder)?