Click here to Skip to main content
15,891,136 members
Home / Discussions / Database
   

Database

 
GeneralRe: ORA-00603: ORACLE server session terminated by fatal error [modified] Pin
Klaus-Werner Konrad13-Apr-11 12:03
Klaus-Werner Konrad13-Apr-11 12:03 
QuestionSQL Server ASPState Blocking under high load Pin
MecAlex13-Apr-11 4:57
MecAlex13-Apr-11 4:57 
AnswerRe: SQL Server ASPState Blocking under high load Pin
Wendelius13-Apr-11 5:07
mentorWendelius13-Apr-11 5:07 
GeneralRe: SQL Server ASPState Blocking under high load Pin
MecAlex13-Apr-11 5:28
MecAlex13-Apr-11 5:28 
GeneralRe: SQL Server ASPState Blocking under high load Pin
Wendelius13-Apr-11 5:34
mentorWendelius13-Apr-11 5:34 
AnswerRe: SQL Server ASPState Blocking under high load [modified] Pin
MecAlex14-Apr-11 22:34
MecAlex14-Apr-11 22:34 
GeneralRe: SQL Server ASPState Blocking under high load Pin
Wendelius15-Apr-11 9:43
mentorWendelius15-Apr-11 9:43 
Questionrealtime update needing [modified] Pin
mersad0013-Apr-11 1:10
mersad0013-Apr-11 1:10 
hi everybody,
I have a big problem with update statement, let me mention the situation by exact script and results!
first create trans table=>

create table trans(
id bigint identity(1,1) not null,
price decimal(18,0) null,
relatedid bigint null)


Then fill it by this script

Insert into trans (price,relatedid)values(100,NULL) 
Insert into trans (price,relatedid)values(100,NULL) 
Insert into trans (price,relatedid)values(500,NULL)
Insert into trans (price,relatedid)values(1,NULL)
Insert into trans (price,relatedid)values(1,3)   


Now run this query!

Update trans
set price=(case when relatedid is null then (select avg(price) from trans where id<=t.id) 
else (select top(1) price from trans where id=t.relatedid) end)
from trans t


After execution of query I expect this result:
id-----price-----relatedid
1 100 NULL
2 300 NULL
3 200 NULL
4 200 3 <======== realy expected!!!!

But this is the result!!!
id-----price-----relatedid
1 100 NULL
2 300 NULL
3 200 NULL <======= #3 row
4 1 3 <===== wrong value, i mean this is the value before update

row with id 3 has been updated before but update doesnt know this!!!!!


WHAT I NEED i need to get expected result from this execution!!!! plzzzzzzzzzzz

modified on Wednesday, April 13, 2011 7:53 AM

AnswerRe: realtime update needing Pin
Corporal Agarn13-Apr-11 2:46
professionalCorporal Agarn13-Apr-11 2:46 
GeneralRe: realtime update needing Pin
mersad0014-Apr-11 3:25
mersad0014-Apr-11 3:25 
GeneralRe: realtime update needing Pin
Corporal Agarn14-Apr-11 3:52
professionalCorporal Agarn14-Apr-11 3:52 
GeneralRe: realtime update needing Pin
mersad0014-Apr-11 8:45
mersad0014-Apr-11 8:45 
AnswerRe: realtime update needing Pin
Wendelius13-Apr-11 5:17
mentorWendelius13-Apr-11 5:17 
QuestionSSAS , No connection could be made because the target machine actively refused it Pin
irfanhaleem@hotmail.com12-Apr-11 22:09
irfanhaleem@hotmail.com12-Apr-11 22:09 
AnswerRe: SSAS , No connection could be made because the target machine actively refused it Pin
Wendelius13-Apr-11 5:18
mentorWendelius13-Apr-11 5:18 
AnswerRe: SSAS , No connection could be made because the target machine actively refused it Pin
S Douglas28-Apr-11 10:55
professionalS Douglas28-Apr-11 10:55 
QuestionHow Do I display current date and time in Toad for Oracle? Pin
Justiin126512-Apr-11 9:45
Justiin126512-Apr-11 9:45 
AnswerRe: How Do I display current date and time in Toad for Oracle? Pin
Wendelius12-Apr-11 10:54
mentorWendelius12-Apr-11 10:54 
AnswerRe: How Do I display current date and time in Toad for Oracle? Pin
Jörgen Andersson12-Apr-11 20:51
professionalJörgen Andersson12-Apr-11 20:51 
AnswerRe: How Do I display current date and time in Toad for Oracle? Pin
Prasanta_Prince13-Apr-11 1:29
Prasanta_Prince13-Apr-11 1:29 
Questionorder by clause Pin
venkat11612-Apr-11 1:47
venkat11612-Apr-11 1:47 
AnswerRe: order by clause Pin
Luc Pattyn12-Apr-11 1:56
sitebuilderLuc Pattyn12-Apr-11 1:56 
GeneralRe: order by clause Pin
venkat11612-Apr-11 2:03
venkat11612-Apr-11 2:03 
GeneralRe: order by clause Pin
Luc Pattyn12-Apr-11 2:10
sitebuilderLuc Pattyn12-Apr-11 2:10 
GeneralRe: order by clause Pin
venkat11612-Apr-11 2:23
venkat11612-Apr-11 2:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.