473,383 Members | 1,885 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Urgent

hi

I have got a table as follows

col1 col2
---- -------
1 1183.74
2 1188.05
3 1202.08
4 1211.92
5 1213.55
6 1213.45
7 1213.54
8 1204.92
9 1210.13
10 1209.57
11 1205.45
12 1194.65
13 1194.22
14 1203.21
15 1205.72
16 1203.38
17 1198.68
18 1188
19 1189.24
20 1182.81
21 1177.07
22 1190.25
23 1191.17

now i want a query which yields the following results
here col3 for record 1 is calculated as follows

(1188.08/(1183.74-1))*100=0.364100225
col1 col2 col3
---- ---- ----------------
1 1183.74 0.364100225
2 1188.05 1.180926729
3 1202.08 0.818581126
4 1211.92 0.134497327
5 1213.55 -0.008240287
6 1213.45 0.007416869
7 1213.54 -0.710318572
8 1204.92 0.432393852
9 1210.13 -0.04627602
10 1209.57 -0.340616913
11 1205.45 -0.89593098
12 1194.65 -0.035993806
13 1194.22 0.752792618
14 1203.21 0.208608639
15 1205.72 -0.19407491
16 1203.38 -0.390566571
17 1198.68 -0.890980078
18 1188 0.104377104
19 1189.24 -0.540681444
20 1182.81 -0.485285042
21 1177.07 1.119729498
22 1190.25 0.077294686
23 1191.17
Jul 23 '05 #1
1 1060
SELECT Col1, Col2, (((SELECT Col2 FROM tbl tbl2 WHERE
tbl2.col1=tbl.col1+1)/NullIf(Col2, 0))-1)*100
FROM tbl

I changed the parenthesis around as the example had them in the wrong
places. I have not tested this as you didnt include the create table/insert
statements for your data.

Mr Tea

"Kalyan" <ka*****@gmail.com> wrote in message
news:8d**************************@posting.google.c om...
hi

I have got a table as follows

col1 col2
---- -------
1 1183.74
2 1188.05
3 1202.08
4 1211.92
5 1213.55
6 1213.45
7 1213.54
8 1204.92
9 1210.13
10 1209.57
11 1205.45
12 1194.65
13 1194.22
14 1203.21
15 1205.72
16 1203.38
17 1198.68
18 1188
19 1189.24
20 1182.81
21 1177.07
22 1190.25
23 1191.17

now i want a query which yields the following results
here col3 for record 1 is calculated as follows

(1188.08/(1183.74-1))*100=0.364100225
col1 col2 col3
---- ---- ----------------
1 1183.74 0.364100225
2 1188.05 1.180926729
3 1202.08 0.818581126
4 1211.92 0.134497327
5 1213.55 -0.008240287
6 1213.45 0.007416869
7 1213.54 -0.710318572
8 1204.92 0.432393852
9 1210.13 -0.04627602
10 1209.57 -0.340616913
11 1205.45 -0.89593098
12 1194.65 -0.035993806
13 1194.22 0.752792618
14 1203.21 0.208608639
15 1205.72 -0.19407491
16 1203.38 -0.390566571
17 1198.68 -0.890980078
18 1188 0.104377104
19 1189.24 -0.540681444
20 1182.81 -0.485285042
21 1177.07 1.119729498
22 1190.25 0.077294686
23 1191.17

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Rob | last post by:
I have a form - when you click the submit button, it appends a variable to the URL (e.g. xyz.cgi?inputID=some_dynamic_variable) It also opens a new page. Now, that some_dynamic_variable is...
9
by: Stefan Bauer | last post by:
Hi NG, we've got a very urgent problem... :( We are importing data with the LOAD utility. The input DATE field data is in the format DDMMYYYY (for days) and MMYYYY (for months). The target...
8
by: Mike | last post by:
Hello, I have a few rather urgent questions that I hope someone can help with (I need to figure this out prior to a meeting tomorrow.) First, a bit of background: The company I work for is...
28
by: Tamir Khason | last post by:
Follwing the struct: public struct TpSomeMsgRep { public uint SomeId;
16
by: | last post by:
Hi all, I have a website running on beta 2.0 on server 2003 web sp1 and I keep getting the following error:- Error In:...
7
by: zeyais | last post by:
Here is my HTML: <style> ..leftcolumn{float:left;width:300px;border: 1px solid #ccc} ..rtcolumn{float:left;width:600px;border: 1px solid #ccc} </style> <body> <div class="leftcolumn"...
33
by: dembla | last post by:
Hey Frnds can anyone help me in this i need a program in 'c' PROGRAM to print NxN Matrix 9 1 8 1 2 3 2 7 3 as 4 5 6 6 4 5 7 8 9 in sorted form
8
by: ginnisharma1 | last post by:
Hi All, I am very new to C language and I got really big assignment in my work.I am wondering if anyone can help me.........I need to port compiler from unix to windows and compiler is written...
3
by: N. Spiker | last post by:
I am attempting to receive a single TCP packet with some text ending with carriage return and line feed characters. When the text is send and the packet has the urgent flag set, the text read from...
7
by: Cirene | last post by:
I used to use the Web Deployment Project with my VS2005 projects. Now I've fully upgraded to VS2008. Do I have to download a new version of the Web Deployment Project? If so where can I find...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.