Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
rito11_96
Starting Member
1 Post |
Posted - 2013-12-19 : 22:57:02
|
I have the following scriptselect A.Ref, if(A.Nil>0,A.Nil,0) as Debit, if(A.Nil<0,-A.Nil,0) as Credit, A.Nil+(select SUM(B.Nil) from Trial as B where B.Ref<A.Ref) as Balance from Trial as AThe sript to repeat many times, there are 100 examples of such records, will perform repetitions eat almost as much as 10,000 times the query!!!but if the number of records the more, the more slowly process its query ...and I have a form that has a script in MySQL optimize queries better, as the script that I write hereselect @MEND:=0;Select @mD:=if(Nil>0,Nil,0) as Debit, @mC:=if(Nil<0,-Nil,0) as Credit, @MEND:=@MEND+@mD-@mC as Balance from trial;+ -------- + ------- + ------- +| Debit | Credit | Balance |+ -------- + ------- + ------- +| 3434 | 0 | 3434 || 3434 | 0 | 6868 || 4434 | 0 | 11302 || 0 | 544 | 10758 || 0 | 453 | 10305 |+ -------- + ------- + ------- +Memory usage script variable @ above, when using Firebird SQL, maybe friends of friends can help us solve the above problem.thank's allsay hello to every body |
|
Kristen
Test
22859 Posts |
Posted - 2013-12-20 : 04:10:05
|
Sorry, but this is a Microsoft SQL Server forum. There may not be people here who can answer a MySQL question, you would be better trying on the forums on the MySQL site. |
|
|
|
|
|
|
|