Problem in query writting , Need a help on priority
Hi there,
Please check the following scenario
there are 2 tables
event - eventId , userId and eventDate
impression - impressionId,userId
After joining -
userId | impressionId | eventId | eventDate
1 | 1 | null | null
1 | 2 | null | null
1 | 3 | 1 | 2007/08/10
1 | 4 | null | null
1 | 5 | null | null
1 | 6 | null | null
1 | 7 | 2 | 2007/08/10
I want the following output to be generated.
userId | impressionPosition | eventCnt
1 | 3 | 1
1 | 4 | 1 (2nd event occured AFTER 4 impressions)
Please give some query clue or sample query.
Thanks in Adv.
-Amol Kashid
you just need to add a partition clause to the analytic function:
with t as (select 1 as userid, 1 as impressionid, null as eventid, null as eventdate from dual
union all select 1, 2,null, null from dual
union all select 1, 3,1, sysdate-5 from dual
union all select 1, 4,null, null from dual
union all select 1, 5,null, null from dual
union all select 2, 6,2, sysdate from dual
union all select 1, 7,2, sysdate from dual
union all select 2, 8,2, sysdate from dual)
select userid, count(*) over(partition by userid order by impressionid) event_sequence,
'Event after '||
to_char(nvl(impressionid - lag(impressionid) over (partition by userid order by impressionid),0))
||' impression(s)' as description
from t
where eventid is not null
USERID EVENT_SEQUENCE DESCRIPTION
1 1 Event after 0 impression(s)
1 2 Event after 4 impression(s)
2 1 Event after 0 impression(s)
2 2 Event after 2 impression(s)
4 rows selected.edit: actually, that screwed up the reporting of the first event.... hmmm....
Similar Messages
-
Looks like a simple query but need your help
Hello everyone,
I have a simple problem but I can't get over it. Actually, it looks like a simple problem, but I can't do it. So,it's probably not... Anyone can help me with this?
Imagine the following data:
ALTER SESSION SET NLS_DATE_FORMAT = 'DD/MM/YYYY HH24:MI:SS';
SELECT TRUNC(SYSDATE) - TO_DATE('01/01/11', 'DD/MM/RR') FROM dual; -- 564
DROP TABLE runs;
CREATE TABLE runs
start_date DATE,
end_date DATE
-- generate some random data
INSERT INTO runs(start_date)
SELECT TO_DATE('01/01/11', 'DD/MM/RR') + trunc(dbms_random.value(0,564))
FROM dual
CONNECT BY LEVEL <= 10000;
-- still generating sample data
UPDATE runs
SET end_date = start_date + dbms_random.value(0,20000) / 86400; -- 20000 sec is the max
COMMIT; If you execute the previous "script", you'll end up with a table called RUNS with 10.000 records. Each record contains a start date and an end date which is max 20.000 second after the start date.
What I would like to do is a report based on these data.
I need something like this:
(first week of 2011 started on sunday. So I go back to the last monday of 2010)
WEEK_NUMBER AVG_FOR_MONDAY_BY_WEEK CUMULATIVE_AVERAGE_FOR_MONDAYS
Week 1: 26/12/2010 - 01/01/2011 9999 88888
Week 2: 02/01/2011 - 08/01/2011 1111 22222
....For each week, I would like to have the average duration (which is the difference in seconds between end_date and start_date) by day (monday needs to have its average, tuesday, wednesday...too)
And I also need a cumulative average by week and by days (mondays, tuesdays...). This cumulative average needs to be based on all the preceding rows.
Can anyone help me with this query? I'm using Oracle 10g
ThanksHi,
Something along these lines :
alter session set nls_date_language = "english";
with all_data as (
select to_char(start_date, 'IYYYIW') as wk
, to_char(start_date, 'dy') as dy
, (end_date - start_date)*86400 as duration
from runs
week_data as (
select wk
, round(avg(case when dy = 'mon' then duration end)) as avg_mon
, round(avg(case when dy = 'tue' then duration end)) as avg_tue
, round(avg(case when dy = 'wed' then duration end)) as avg_wed
, round(avg(case when dy = 'thu' then duration end)) as avg_thu
, round(avg(case when dy = 'fri' then duration end)) as avg_fri
, round(avg(case when dy = 'sat' then duration end)) as avg_sat
, round(avg(case when dy = 'sun' then duration end)) as avg_sun
from all_data
group by wk
select wk
, avg_mon
, sum(avg_mon) over(order by wk) as cum_avg_mon
, avg_tue
, sum(avg_tue) over(order by wk) as cum_avg_tue
, avg_wed
, sum(avg_wed) over(order by wk) as cum_avg_wed
, avg_thu
, sum(avg_thu) over(order by wk) as cum_avg_thu
from week_data
order by wk;
WK AVG_MON CUM_AVG_MON AVG_TUE CUM_AVG_TUE AVG_WED CUM_AVG_WED AVG_THU CUM_AVG_THU
201052
201101 9836 9836 8737 8737 9088 9088 12167 12167
201102 7639 17475 10319 19056 7391 16479 8036 20203
201103 8275 25750 8883 27939 8525 25004 11682 31885
201104 7029 32779 10850 38789 7360 32364 7617 39502
201105 10292 43071 11421 50210 11141 43505 9469 48971
201106 11612 54683 9762 59972 11464 54969 9517 58488
201107 8645 63328 10206 70178 10124 65093 11917 70405
201108 11466 74794 11678 81856 10839 75932 9587 79992
201109 8745 83539 6803 88659 8963 84895 9496 89488
201110 10443 93982 8104 96763 10314 95209 10908 100396
201111 8183 102165 9467 106230 11495 106704 12040 112436
201112 8575 110740 9207 115437 10338 117042 9561 121997
201113 10273 121013 6268 121705 11288 128330 12335 134332
201114 10176 131189 8561 130266 10367 138697 7983 142315
201115 10587 141776 12073 142339 8528 147225 12271 154586
201116 9393 151169 10761 153100 7901 155126 10020 164606
201117 11459 162628 9471 162571 10136 165262 8188 172794
201118 11946 174574 9997 172568 9367 174629 10475 183269
201119 12869 187443 9848 182416 7692 182321 9632 192901
201120 9675 197118 7408 189824 11646 193967 9614 202515
201121 10742 207860 10302 200126 9208 203175 7543 210058
201122 8083 215943 8323 208449 10045 213220 9498 219556
201123 11838 227781 8820 217269 8804 222024 10485 230041
201124 8748 236529 12143 229412 9684 231708 8402 238443
201125 11504 248033 10586 239998 10073 241781 9573 248016
201126 7289 255322 14241 254239 10100 251881 11843 259859
201127 10855 266177 9980 264219 10320 262201 11023 270882
201128 11004 277181 9975 274194 11609 273810 8945 279827
201129 10488 287669 9402 283596 11985 285795 9481 289308
201130 7338 295007 8963 292559 11982 297777 8177 297485
201131 9778 304785 10024 302583 10732 308509 10749 308234
201132 10360 315145 12577 315160 8643 317152 10001 318235
201133 9845 324990 10416 325576 9996 327148 10548 328783
201134 9540 334530 8138 333714 9401 336549 9093 337876
201135 7000 341530 9920 343634 10370 346919 10937 348813
201136 11307 352837 8889 352523 12339 359258 8491 357304
201137 11785 364622 9146 361669 9232 368490 11023 368327
201138 7857 372479 6784 368453 8502 376992 12558 380885
201139 9842 382321 10616 379069 10435 387427 7848 388733
201140 10578 392899 9402 388471 8806 396233 9927 398660
201141 6711 399610 13015 401486 9934 406167 10011 408671
201142 10088 409698 10380 411866 7836 414003 9205 417876
201143 8132 417830 11772 423638 10792 424795 10834 428710
201144 9921 427751 7454 431092 9551 434346 10754 439464
201145 13196 440947 11600 442692 11303 445649 10455 449919
201146 12022 452969 8996 451688 10221 455870 12567 462486
201147 8965 461934 10068 461756 10607 466477 13486 475972
201148 9483 471417 9264 471020 9601 476078 8685 484657
201149 11738 483155 9000 480020 10284 486362 11263 495920
201150 10338 493493 10237 490257 10357 496719 10984 506904
201151 10777 504270 11138 501395 10543 507262 9840 516744
201152 9881 514151 10692 512087 11432 518694 10122 526866
201201 11089 525240 8077 520164 12391 531085 9649 536515
201202 9871 535111 8326 528490 9449 540534 10551 547066
201203 10625 545736 11609 540099 9626 550160 5795 552861
201204 8856 554592 9679 549778 10722 560882 11064 563925
201205 9379 563971 9943 559721 8409 569291 11656 575581
201206 10843 574814 10070 569791 12162 581453 10764 586345
201207 8424 583238 8484 578275 8382 589835 8716 595061
201208 11159 594397 10415 588690 11459 601294 11317 606378
201209 11264 605661 8244 596934 9682 610976 10192 616570
201210 11514 617175 9322 606256 9101 620077 10571 627141
201211 9348 626523 7501 613757 12297 632374 11170 638311
201212 10523 637046 7605 621362 10348 642722 10068 648379
201213 10411 647457 11686 633048 10212 652934 9574 657953
201214 9394 656851 10526 643574 8521 661455 9829 667782
201215 8994 665845 12256 655830 8243 669698 10592 678374
201216 11491 677336 10939 666769 12846 682544 9708 688082
201217 9737 687073 9611 676380 7244 689788 10943 699025
201218 9024 696097 11286 687666 10033 699821 10314 709339
201219 9851 705948 9851 697517 9159 708980 9917 719256
201220 7785 713733 10490 708007 8534 717514 8528 727784
201221 11107 724840 8197 716204 8926 726440 10834 738618
201222 8093 732933 11853 728057 11697 738137 10081 748699
201223 9371 742304 10796 738853 11068 749205 9904 758603
201224 10600 752904 8487 747340 10838 760043 8009 766612
201225 11090 763994 9595 756935 10736 770779 9387 775999
201226 8234 772228 12759 769694 9119 779898 8422 784421
201227 9738 781966 9383 779077 8978 788876 11635 796056
201228 11687 793653 10302 789379 9459 798335 10608 806664
201229 9245 802898 11290 800669 798335 806664
82 rows selected -
Huge problems with wireless, would need some help
Sorry for the bad topic, and sorry for my english.
And now the problem.
I have just bought my first laptop, and got almost everything to play nice in arch, except the wireless.
My card is a Intel PRO/Wireless 3945ABG (iwl3945), and i have a Dlink 524 router (abg).
Using WAP, but can change this if its help.
Right now I'am using NetworkManager (0.6.5-3 from rep) and KNetworkManager (from AUR), and it works very very bad.
It can't connect at startup (or atleast it doesn't...), it takes several attempts to get a connection, it drops the connection and dont reconnect when it does, and so on. Its almost unusable and force me to use wired a connection just to be sure to be able to write this.
After what i read in different forums and mailinglists, there seems to be a lot of problems with wireless at the moment?
Anyone got this combination to work fine? Or are there any other way of configuration i should try? Suggestions?
Thanks in advance!I've had a lot of problems with wireless networking for several weeks recently, ever since I upgraded vanilla kernel26 from v.2.6.22 to v.2.6.23 (see http://bbs.archlinux.org/viewtopic.php?id=40145). I'm using the Windows driver bcmwl5 for the Broadcom 4311 chipset via Ndiswrapper, and I'm using WPA-PSK (TKIP) encryption. I also use a D-Link DI-524 router. What finally cured the problem was to install the new wicd (v.1.3.1) network manager which is now in extra and to set up all networking interfaces in that GUI, abandoning using Arch network profiles and all the detailed setup in /etc/rc.conf.
My /etc/rc.conf now only contains (I'm only showing entries pertinent to networking)
MODULES=(ndiswrapper capability sg acpi-cpufreq cpufreq_ondemand cpufreq_performance cpufreq_powersave)
HOSTNAME="RFDellLT"
DAEMONS=(syslog-ng @nfslock @nfsd @netfs @crond !network hal cpufreq portmap wicd sshd cups alsa @openntpd privoxy)
i.e. no more INTERFACES, not even "lo", gateway, ROUTES, NET_Profiles. Everything is set up through wicd. You only need to put the wicd daemon in the DAEMONS array (after hal which also loads dbus), and the network daemon isn't needed anymore. Also you should uninstall any other networkmanager.
To put the wicd icon in the system tray, create a shell script (give it any name) in the .kde/Autostart/ directory in your home directory (if you use KDE, otherwise do the equivalent thing for any other DE/WM) that contains the command /usr/lib/wicd/tray.py.
You may want to try wicd, perhaps it'll fix your problem. It certainly has gotten good press in this forum. -
Problems with MSN Messenger - need quick help
I posted yesterday that I was having some trouble with my Ameritrade stock trading account, it was a java issue and they had me delete the cache in java and my Ameritrade worked again.
Now this morning I'm having problems with MS messenger which I use all day long for my job. When I try to sign in it keeps telling me it can't sign me in and I must not be connected to the internet. Which I am.
Its got some thing to do with my airport wireless thingy. Is there some way to "open" that up. When I unplug it and then replug it back in I can sign in to MS messenger for about a minute but then it somehow blocks it.
It keeps me on the internet but I get a message that I an not connected to .NET Messenger service. It is blocking me on my laptop PC now too. And it behaves the same way. After unplugging the airport I get a quick window where I can sign in but after that it blocks that .NET messenger service.
Is there some way I can open up the airport so I can get on the NET messenger service. Skype and iChat work but I can't use either for my job.
Does anyone have any suggestions (I'm begging here cuz i start work at 9:30 am and I need it working by then!).
Thanks, SusanWow this is a mess, I want to add that again i'm sure its the airport extreme somehow. However on my PC laptop I can sign into messenger with an older version of it but when i try the new LIVE messenger it won't let me sign in.
The iMac version forces you to use the latest version so I can't use an older "non live" version to sign in with. I am praying someone can help me figure out what is wrong.
Thanks sorry for reposting but i'm frantic!
Susan -
A Oracle sql query is needed, please help me out
Hi,
I have a table similar to scott.emp table and i should get first three recently joined employees salaries according to their joined date from each deptno
output should like this:
deptno firstempsalary secondemplsal thirdemploysalary
10 xxx xxx xxxx
20 xx xx
30 xx xxx xxxx
40 xx
50 xx xxxx xxx
60 xx xx
70 xx
it means that 70 dept having only one employee and 20 dept having only two employees and 10 dept having more than three employees but we should get only three recently joined employees salaries from 10 dept.
Hope this is clear .. please give me a query to get this info ..
oracle is 10g version
great thanks in advance.select deptno,
max(case jd_rank when 1 then salary end) firstempsal,
max(case jd_rank when 2 then salary end) secondempsal,
max(case jd_rank when 3 then salary end) thirdempsal
from
(select salary, deptno, row_number() over(partition by deptno order by join_date desc) jd_rank from emp)
group by deptno
Problem here is what to do when employees have the same join date? This example will arbitrarily choose their order and if, for example, three employees share the same (most recent) join date then they will arbitrarily be classed as "first", "second" and "third". If four employees join at the same time, one of them will be ignored at random!
Edited by: user10548434 on 03-Dec-2008 06:27 -
Query Discrepency - Need some help understanding Grouping/Parentheses.
When I run:
SELECT TECHNICAL_SERVICE,LOGICAL_NAME,COUNT("NUMBER"),ROUND(AVG(CLOSE_TIME-OPEN_TIME),2) as time
from SMINCREQ
where
TECHNICAL_SERVICE='CLIENT SOFTWARE INSTALLATION' or TECHNICAL_SERVICE='REIMAGE'
and
open_time>'7/1/2011' GROUP BY (TECHNICAL_SERVICE,LOGICAL_NAME) ORDER BY TIME DESC
I get the folowing with a total of 1925 rows minus the 3067 from the top weird row returned....
++++++++++++++++
TECHNICAL_SERVICE LOGICAL_NAME COUNT(NUMBER")" TIME
CLIENT SOFTWARE INSTALLATION - 3067 6.72
REIMAGE WINDOWS 7 (client os) 194 2.1
CLIENT SOFTWARE INSTALLATION BLANK (blank) 151 6.1
CLIENT SOFTWARE INSTALLATION PRINTER DRIVER/INSTALL-UPGRADE (client printing app) 128 12.73
CLIENT SOFTWARE INSTALLATION SPSS (statistical app) 112 4.16
CLIENT SOFTWARE INSTALLATION WINDOWS 7 (client os) 100 3.3
CLIENT SOFTWARE INSTALLATION NETWORK PRINTER SOFTWARE (client printing app) 96 1.45
CLIENT SOFTWARE INSTALLATION IRON MOUNTAIN CLIENT BACKUP WINDOWS (app-module) 91 6.66
CLIENT SOFTWARE INSTALLATION FILEMAKER DATABASE (database app) 73 2.02
CLIENT SOFTWARE INSTALLATION WINDOWS (client os) 70 2.62
++++++++++++++++++++
When then I run
SELECT TECHNICAL_SERVICE,LOGICAL_NAME,COUNT("NUMBER") as dacount,ROUND(AVG(CLOSE_TIME-OPEN_TIME),2) as time
from SMINCREQ
where (TECHNICAL_SERVICE='CLIENT SOFTWARE INSTALLATION' or TECHNICAL_SERVICE='REIMAGE')
and open_time>'7/1/2011' GROUP BY (TECHNICAL_SERVICE,LOGICAL_NAME) ORDER BY dacount DESC
I get 1735 rows with the top ones being
+++++++++++++++++++++++++++++
REIMAGE WINDOWS 7 (client os) 194 2.1
CLIENT SOFTWARE INSTALLATION BLANK (blank) 143 2.54
CLIENT SOFTWARE INSTALLATION PRINTER DRIVER/INSTALL-UPGRADE (client printing app) 120 13.55
CLIENT SOFTWARE INSTALLATION SPSS (statistical app) 105 4.13
CLIENT SOFTWARE INSTALLATION WINDOWS 7 (client os) 100 3.3
CLIENT SOFTWARE INSTALLATION NETWORK PRINTER SOFTWARE (client printing app) 79 1.27
CLIENT SOFTWARE INSTALLATION IRON MOUNTAIN CLIENT BACKUP WINDOWS (app-module) 71 6.81
CLIENT SOFTWARE INSTALLATION FILEMAKER DATABASE (database app) 64 1.95
+++++++++++++++++++++++++++++
When I run
SELECT LOGICAL_NAME,TECHNICAL_SERVICE from SMINCREQ WHERE ((TECHNICAL_SERVICE='CLIENT SOFTWARE INSTALLATION' and LOGICAL_NAME='BLANK (blank)')) and open_time>'7/1/2011' order by LOGICAL_NAME
I get 143 rows returned.. so how do I get the 151 in the original query in the this post
When I run
SELECT LOGICAL_NAME,TECHNICAL_SERVICE from SMINCREQ WHERE ((TECHNICAL_SERVICE='CLIENT SOFTWARE INSTALLATION' or TECHNICAL_SERVICE='REIMAGE')) and open_time>'7/1/2011' order by LOGICAL_NAME
I get 1734 rows...I'm just a bit SQL confused.
thanks
Rob
Edited by: bostonmacosx on Mar 28, 2012 12:23 PMIn Oracle, and is a higher precedence operator than or, so without parens, your first query is equivalent to:
SELECT TECHNICAL_SERVICE, LOGICAL_NAME, COUNT("NUMBER"),
ROUND(AVG(CLOSE_TIME-OPEN_TIME),2) as time
from SMINCREQ
where TECHNICAL_SERVICE = 'CLIENT SOFTWARE INSTALLATION' or
(TECHNICAL_SERVICE='REIMAGE' and
open_time > '7/1/2011')
GROUP BY (TECHNICAL_SERVICE,LOGICAL_NAME)
ORDER BY TIME DESCThat is, find rows where technical_service is CLIENT SOFTWARE INSTALLATION regardless of open_time or
technical_service is REIMAGE and open_time is after 7/1/2011.
Your second query is asking for rows where technical_service is either CLIENT SOFTWARE INSTALLATION or REIMAGE and open_time is after 7/1/2011.
Your third query is looking technical_service CLIENT SOFTWARE INSTALLATION and logical_name BLANK (blank) and open_time after 7/1/2011. It sould be written without parens at all.
You fourth query is the same as your second with an extra (redundant) set of parens.
Another issue that may be causing you problems is the use of a string in the comparision to open_time. If that column is defined as a date in the table, then you should really be using to_date('7/1/2011', 'dd-mm-yyyy') for the literal to avoid implicit data type conversions. If it is actually a varchar2, then you are in for a lot of trouble, unless it is very consistenly formatted.
John -
Serious problems with paint method, need major help
I've got a mjor problem with displaying a BufferedImage Object. My program takes in an image, i call a method on it which creates an ImageObject, imgObj, which contains the following values:
Image width, called width
Image height, called height,
array of 8 bit integers for the ARGB value of each pixel, called int [] imgCol
I've managed to create a Buffered Image of the form:
//make a buffered image ready to take the array of pixels
bufferedImage = new BufferedImage( imgObj.width, imgObj.height, BufferedImage.TYPE_INT_ARGB);
Then I set the ARGB values in the BufferedImage, by specifying the integer array of pixels, imgCol:
//set the values in the buffered image using buffered image method
bufferedImage.setRGB( 0, 0, imgObj.width, imgObj.height, imgObj.imgCol, 0, imgObj.width);
Then I try to paint it, callling repaint() in the same method as the code above.
Now when I try the following stuff I get a Null Pointer Exception:
public void paint(Graphics g){
paintImage(g);
public void paintImage(Graphics g){
Graphics2D ImageGraphic2 = (Graphics2D)g;
// Draws the buffered image to the screen.
ImageGraphic2.drawImage(bufferedImage, 0, 0, this);
Can anyone help me in fixing this problem?Here's the full stack trace, can't make heads or tails of what it's about though
Full thread dump Java HotSpot(TM) Client VM (1.4.1_01-b01 mixed mode):
"AWT-EventQueue-0" prio=7 tid=0x0ADAB440 nid=0xb38 in Object.wait() [ef5f000..e
5fd8c]
at java.lang.Object.wait(Native Method)
- waiting on <02F78010> (a java.awt.EventQueue)
at java.lang.Object.wait(Object.java:426)
at java.awt.EventQueue.getNextEvent(EventQueue.java:333)
- locked <02F78010> (a java.awt.EventQueue)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchT
read.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThr
ad.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136
at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
"DestroyJavaVM" prio=5 tid=0x00034DB8 nid=0x5dc waiting on condition [0..7fadc]
"Java2D Disposer" daemon prio=10 tid=0x0AD4D1F0 nid=0x218 in Object.wait() [ef9
000..ef9fd8c]
at java.lang.Object.wait(Native Method)
- waiting on <02FE9938> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
- locked <02FE9938> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
at sun.java2d.Disposer.run(Disposer.java:97)
at java.lang.Thread.run(Thread.java:536)
"AWT-Windows" daemon prio=7 tid=0x0ACB1528 nid=0x63c runnable [aeff000..aeffd8c
at sun.awt.windows.WToolkit.eventLoop(Native Method)
at sun.awt.windows.WToolkit.run(WToolkit.java:253)
at java.lang.Thread.run(Thread.java:536)
"AWT-Shutdown" prio=5 tid=0x0ACB1158 nid=0x480 in Object.wait() [aebf000..aebfd
c]
at java.lang.Object.wait(Native Method)
- waiting on <02FA4990> (a java.lang.Object)
at java.lang.Object.wait(Object.java:426)
at sun.awt.AWTAutoShutdown.run(AWTAutoShutdown.java:259)
- locked <02FA4990> (a java.lang.Object)
at java.lang.Thread.run(Thread.java:536)
"Signal Dispatcher" daemon prio=10 tid=0x009E8350 nid=0x788 waiting on conditio
[0..0]
"Finalizer" daemon prio=9 tid=0x0003E978 nid=0x3f0 in Object.wait() [ab1f000..a
1fd8c]
at java.lang.Object.wait(Native Method)
- waiting on <02F699B0> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
- locked <02F699B0> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
"Reference Handler" daemon prio=10 tid=0x0003D548 nid=0x7a4 in Object.wait() [a
df000..aadfd8c]
at java.lang.Object.wait(Native Method)
- waiting on <02F69A18> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:426)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:113)
- locked <02F69A18> (a java.lang.ref.Reference$Lock)
"VM Thread" prio=5 tid=0x009E52C0 nid=0x974 runnable
"VM Periodic Task Thread" prio=10 tid=0x009E7040 nid=0x4e4 waiting on condition -
Interesting date query I need some help with
I need to select dates for each day starting from a
particular date up until the present day. These dates are for days
where a value doesn't exist in the table.
Thanks for any advice> how to do this purely in sql
In ms sql you could use a table valued udf. The udf could
generate the dates and insert them into a table variable that would
be used in your join. The basic logic is the same. Create two
variables: @startDate and @todaysDate. Then loop while the start
date is <= today's date. Within each loop insert the current
date into the table variable, and increment the start date
http://msdn.microsoft.com/en-us/library/ms191165.aspx
while @startDate <= @today
begin
insert into @dateTable (theDate) values (@startDate)
set @startDate = dateAdd(d, 1, @startDate)
end
Though personally I prefer using using a permanent calendar
table. I use that table in my selects rather than generating a
table of dates each time. -
Random new line issue in email attachment using utl_smtp need your help.
Hi
I am getting one problem unable to solve, need your help.
I am creating one csv attachment in email using utl_smtp.
but there are random newline in the attachment value so the csv getting corrupted.
following is the attachment code
FOR C2 IN CUR_VALIDATION_ERROR
LOOP
IF CUR_VALIDATION_ERROR%ROWCOUNT = 1 THEN
UTL_SMTP.write_data(l_mail_conn,'"LOG DATE","DATA ERROR IDENTIFIER","EMPLOYEE ID","SOURCE SYSTEM","SOURCE FILE ROW","ERROR LEVEL","ERROR MESSAGE"'||CHR(13));
END IF;
UTL_SMTP.write_data(l_mail_conn,
chr(34)||C2.LOG_DT||chr(34)||chr(44)||
chr(34)||C2.DATA_ERR_ID||chr(34)||chr(44)||
chr(34)||C2.EMPE_ID||chr(34)||chr(44)||
chr(34)||C2.SOURCE||chr(34)||chr(44)||
chr(34)||C2.SOURCE_ROW||chr(34)||chr(44)||
chr(34)||C2.ERROR_LEVEL||chr(34)||chr(44)||
chr(34)||C2.ERR_MSG_DSCR||chr(34)||
CHR(13));
END LOOP;Thank you hm, but that is not the case, bcz I found newline character inside a sequence number. Its not possible to have newline character inside a sequence number
"LOG DATE","DATA ERROR IDENTIFIER","EMPLOYEE ID","SOURCE SYSTEM","SOURCE FILE ROW","ERROR LEVEL","ERROR MESSAGE"
"02-MAY-2012","7893660","123","XYZ","44952","WARNING","[02-MAY-12] - The value in field [PHONE]"
"02-MAY-2012","7893663","12
4","XYZ","52382","WARNING","[02-MAY-12] - The value in field [ADDRESS]" -
Need huge help on my router WRT120 N thanks
Hi, new here, really needed some help regarding my Linksys router WRT 120 N, which i bought not too long ago. Long story short, had it for ps3 online and it worked terrific, tried to get it too connect with the 360 and a disaster.
My idea was too uninstall anything Linksys has and then reinstall the same router. I figured that way i could go back to the previous settings before i tinkered with them for the 360, and just start fresh with a new SSID and have an easier time that way. So i tried, a number of times, but everytime i do, it says the program/router is already installed, leaving me with little to no idea what to do to get it back to workign with the ps3, let alone ever trying for the 360.
By the way, as you may tell, im pretty much tech illiterate, didnt grow up around it and now that i have it, it confuses me quite alot. I feel most comfortable just figuring out how to uninstall it, that is my preference, but if some one knows how i can fix it without doing that and getting my 360 and ps3 online with it, would also appreciate that. I migth not understand lingo, but im very driven to get this over with, i have been pulling my hair out for hours trying with my very limited knowledge.
Again, any help and all help is so so very appreciated, thank you so much in advance.
If you need any other information, please dont hesistate to ask me.Before using the setup program again, you will need to reset your router to factory defaults.
To reset your router to factory defaults, use the following procedure:
1) Power down all computers, the router, and the modem, and unplug them from the wall.
2) Disconnect all wires from the router.
3) Power up the router and allow it to fully boot (1-2 minutes).
4) Press and hold the reset button for 30 seconds, then release it, then let the router reset and reboot (2-3 minutes).
5) Power down the router.
6) Connect one computer by wire to port 1 on the router (NOT to the internet port).
7) Power up the router and allow it to fully boot (1-2 minutes).
8) Power up the computer (if the computer has a wireless card, make sure it is off).
9) Try to ping the router. To do this, click the "Start" button > All Programs > Accessories > Command Prompt. A black DOS box will appear. Enter the following: "ping 192.168.1.1" (no quotes), and hit the Enter key. You will see 3 or 4 lines that start either with "Reply from ... " or "Request timed out." If you see "Reply from ...", your computer has found your router.
10) Open your browser and point it to 192.168.1.1. This will take you to your router's login page. Leave the user name blank, and in the password field, enter "admin" (with no quotes). This will take you to your router setup page. Note the version number of your firmware (usually listed near upper right corner of screen). Exit your browser.
If you get this far without problems, try the setup disk (or setup the router manually, if you prefer), and see if you can get your router setup and working.
If you cannot get "Reply from ..." in step 9 above, your router is likely dead. Report back with this problem
If you get a reply in step 9, but cannot complete step 10, then either your router is dead or the firmware is corrupt. Report back with this problem.
If you need additional help, please state your ISP, the make and model of your modem, your router's firmware version, and the results of steps 9 and 10. Also, if you get any error messages, copy them exactly and report back.
Please let me know how things turn out for you. -
Hi,
I need a help in writing an SQL query . I am actually confused how to write a query. Below is the scenario.
CREATE TABLE demand_tmp
( item_id NUMBER,
org_id NUMBER,
order_line_id NUMBER,
quantity NUMBER,
order_type NUMBER
CREATE TABLE order_tmp
( item_id NUMBER,
org_id NUMBER,
order_line_id NUMBER,
open_flag VARCHAR2(10)
INSERT INTO demand_tmp
SELECT 12438,82,821,100,30 FROM dual;
INSERT INTO demand_tmp
SELECT 12438,82,849,350,30 FROM dual;
INSERT INTO demand_tmp
SELECT 12438,82,NULL,150,29 FROM dual;
INSERT INTO demand_tmp
SELECT 12438,82,0,50,-1 FROM dual;
INSERT INTO order_tmp
SELECT 12438,82,821,'Y' FROM dual;
INSERT INTO order_tmp
SELECT 12438,82,849,'N' FROM dual;
Demand_tmp:
Item_id org_id order_line_id quantity order_type
12438 82 821 100 30
12438 82 849 350 30
12438 82 NULL 150 29
12438 82 0 50 -1
Order_tmp :
Item_id org_id order_line_id open_flag
12438 82 821 Y
12438 82 849 N I need to fetch the records from demand_tmp table whose order_line_id is present in order_tmp and having open_flag as 'Y' or if order_type in demand_tmp table is 29.
The below query will give the records whose order line id is present in order_tmp. But, If i need records which are having order_type=29 the below query wont return any records as order_line_id is NULL. If I place outer join I will get other records also (In this example order_type -1 records) . Please help me how can we write a query for this. Expected o/p is below.
Query :
Select item_id,org_id,order_line_id,quantity,order_type,open_flag
from demand_tmp dt , order_tmp ot
where dt.order_line_id = ot.order_line_id
AND dt.item_id=ot.item_id
AND dt.org_id = ot.org_id
AND ot.open_flag = 'Y';
Expected Output :
item_id org_id order_line_id quantity order_type open_flag
12438 82 821 100 30 Y
12438 82 NULL 150 29 NULL Thanks in advance,
Rakesh
Edited by: Venkat Rakesh on Oct 7, 2012 6:32 PM
Edited by: Venkat Rakesh on Oct 7, 2012 8:39 PMHi Rakesh,
the query is not working as you would like ( but IS working as expected ) since your trying to compare null to another value.
Comparing null always results in FALSE, also if you compare null to null. This is because null means undefined.
select 1 from dual where null=null results in no data found.
I would suggest using a non natural key to join the tables.
For example include a column ID in the master table which is filled with a sequence and include that field as a foreign key in the detail table.
This way you can easily join master and detail on ID = ID, and you don't have to worry about null values in this column since it's always filled with data.
Regards,
Bas
btw, using the INNER JOIN and OUTER JOIN syntax in your SQL makes it better readable, since you're separating join conditions from the where clause, just a tip ;) -
Roland Edirol, NEED TRACKING HELP!!!!! Weird Problem!
I need the help of one of you experts...
New to Logic but have used GarageBand for years. I am using a Roland Edirol UA-25EX interface. I am attempting to track a bass part in a project but have encountered a weird problem.
When I play the bass with the rest of the project (MIDI Drums and Piano) the input signal is at a constant state of peaking no matter how hard I play. I assumed that I was just sending to much signal into the computer from the interface so I soloed my bass track and all of a sudden it sounded fine (levels were good - no peaking). Then I un-soloed the track again and the crazy peaking was back.
After playing around with Logic and the Edirol for a few hours I couldn't trouble shoot the problem. I decided to hit record and see if Logic was recording the peaked out sound I heard (UNSOLOED) or the normal non-peaked bass tone I heard when it was soloed out. Sure enough when I listened back to the recording everything sounded fine!!
Thats good I guess... but I cannot track the bass part with the peaked out sound and when I turn it down to try and get rid of the clipping, I can't hear the bass enough.
Can someone help me with this please?!?!? Point me in a direction at least to try anything.....I have an Edirol UA-25 that has drivers that stop working anytime there is an upgrade or sleep. You should write to Roland and complain, they were friendly and sent a zip of 10 copies of the driver and it's un-installer, so if,like today i let my iMac fall sleep the driver no longer works and I must unplug the USB Edirol,un-install the broken driver and install a new one before the Edirol will work again-I am on 10.5.8, hopefully the Snow Leopard drivers will be better. your "ex" model differs only in it's having a ground loop isolator, which I had to buy separately and it works fine but still not fair of Roland to sell such crap.
-
My daughter has spitefully changed my password and has refused to tell me. I have so much medical information that I can not lose. Is there anyway to get around this problem. Please I need Help fast.
Connect the iPod to your syncing computer and restore it via iTunes. However, if iTunes asks for the unknown passcode you need to place the iPod in recovery mode and then restore the iPod from backup. For recovey mode see:
iPhone and iPod touch: Unable to update or restore
"If you cannot remember the passcode, you will need to restore your device using the computer with which you last synced it. This allows you to reset your passcode and resync the data from the device (or restore from a backup). If you restore on a different computer that was never synced with the device, you will be able to unlock the device for use and remove the passcode, but your data will not be present. Refer to Updating and restoring iPhone and iPod touch software."
Above is from:
http://support.apple.com/kb/ht1212 -
hi i have an ipad mini and i have not used it for 2 month or more. Today i have tried to use it i came across with a problem. my Ipad is blocked and it asks me to wait 23,401,418 what should i do need your help. thanks
Have you charged ipad Try a Reboot press & hold power button & menu button hold both down until you see Apple Logo You may need to do this more than once. Bsydd uk
-
Hi,
A few songs from my old purchase is not available for download. It shows as purchased but I can't download it. Please help me resolve this problem, what do I need to do to enable download for all my purchased songs/movies etc.
- AvinashThe purchases are probably hidden:
http://support.apple.com/kb/ht4919
Maybe you are looking for
-
Crystal report - generate CSV file through Java interface
Hi, I need to generate a Character Seperated File through Crystal Report 10 using Java. What constant stands for CSV Format and what value of SI_PROGID we can provide to pull the CSV format. Eg. SI_PROGID = ceProgID.EXCEL or SI_PROGID = ceProgID.PDF
-
When will the release iOS 6.0.1
When will the release of the operating system iOS 6.0.1, who knows, or until no one knows?
-
Hi, I bought new 4GB memory card and i copied my all data from existing 512MB card to the new 4GB card, But some times i am not able to view my data. But when i check in memeory deails its showing you usable size is my data size. Also when ever i swi
-
I get an'MSQL error number2002' when trying to use my toolbar game button how does one fix this
MSQL error number 2002
-
I'm stuck on a homework assignment. I am not asking anyone to write this for me, but I am stuck. I have no idea even how to start this program. Any help will be greatly appreciated. Use the LinkedStack class to support an application that tracks