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 |
|
babuuser9
Starting Member
3 Posts |
Posted - 2011-03-25 : 16:59:31
|
| [code][/code]SQL> create table cal (open number(3), high number(3), low number(3), close number(3));Table created.SQL> insert into cal values(1, 3, 5, 7);1 row created.SQL> insert into cal values(34, 23, 23, 12);1 row created.SQL> insert into cal values(45, 56, 56, 56);1 row created.SQL> insert into cal values(98, 786, 34, 23);1 row created.SQL> insert into cal values(100, 65, 12, 23);1 row created.SQL> insert into cal values(23, 45, 23, 45);1 row created.SQL> insert into cal values(154, 34, 34, 34);1 row created.SQL> insert into cal values(12, 4, 2, 6);1 row created.SQL> select * from cal; OPEN HIGH LOW CLOSE---------- ---------- ---------- ---------- 1 3 5 7 34 23 23 12 45 56 56 56 98 786 34 23 100 65 12 23 23 45 23 45 154 34 34 34 12 4 2 68 rows selected.i want to query a column with ((high + open)/close)where high and open are from the 1st row and close is from 2nd rowhow can i do it in sqli know hot to do it in excel, but i need to do it in sqlis there a way at all to do it in sql |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-03-25 : 17:23:10
|
There is no datatype NUMBER in MS Sql Server.There is no reliable order of rows in a table so there is no way to decide what is the first or second row in your sample data/table.If this is ORACLE then you will get better help in an ORACLE forum. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
alinora14
Starting Member
5 Posts |
Posted - 2011-03-25 : 23:47:12
|
| hi,i have something interesting for you about the query you have asked.-----------unspammed |
 |
|
|
|
|
|
|
|