473,386 Members | 1,867 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,386 software developers and data experts.

Calculation on same table with same column

hi,

i have the 2 following table in my database.

tablename : tblMutFunds

code.......shortname......number......display_web
G1..........Growth1......... 1...............1
G2..........Growth2......... 3...............1
G3..........Growth3......... 5...............1
G4..........Growth4......... 2...............0
G5..........Growth5......... 4...............1
G6..........Growth6......... 8...............1
G7..........Growth7......... 7...............0
G8..........Growth8......... 6...............1
G9..........Growth9......... 9...............0

tablename : tblMutFundPrice

fund_code.......fund_nav.......fund_date
G1...................0.2896.......01/12/2007
G2...................0.4246.......01/12/2007
G3...................0.3794.......01/12/2007
G4...................0.8001.......01/12/2007
G5...................0.4246.......01/12/2007
G6...................0.9347.......01/12/2007
G7...................0.3794.......01/12/2007
G8...................0.2896.......01/12/2007
G9...................0.3971.......01/12/2007
G1...................0.1122.......01/13/2007
G2...................0.4220.......01/13/2007
G3...................0.3770.......01/13/2007
G4...................0.8090.......01/13/2007
G5...................0.4225.......01/13/2007
G6...................0.9471.......01/13/2007
G7...................0.3841.......01/13/2007
G8...................0.2159.......01/13/2007
G9...................0.3111.......01/13/2007

The RESULT i want is....

Number......Fund_Name.......NAV.........Change.... ....Change%......Date............Display_Web
1....................Growth1.........0.1122.....-0.0050.........-1.26............01/13/2007.................1
3....................Growth2.........0.4246.....+0 .0004........+0.04...........01/13/2007.................1
4....................Growth5.........0.4225.....-0.0059.........-1.36............01/13/2007.................1
5....................Growth3.........0.3794.....+0 .0004.........+0.04..........01/13/2007.................1
6....................Growth8.........0.2159.....-0.0080.........-1.04............01/13/2007.................1
8....................Growth6.........0.9471.....-0.0037.........-0.96............01/13/2007.................1

The CHANGE is calculate based on NAV of previous date (01/12/2007).
The CHANGE% is calculate % based on NAV of previous date (01/12/2007).

For the CHANGE and CHANGE% column data are just sample, incorrect data.

Another thing, ONLY records with display_web column value = "1" is display the result. Records value with "0" are not displayed.

Well i hope u guys pls pls help me.....THX.....
Oct 23 '07 #1
2 1316
JamieHowarth0
533 Expert 512MB
Hi vinothrao,

Have you tried coding any of this yourself so far?

The idea of the forum is to provide help and guidance with code-specific problems, not to write your code for you. All experts contribute their time and expertise freely (which is of considerable value) and without expectation of recompense - but in return, we expect you to have at least made attempts at what you are trying to do.
If in any doubt then please read the Posting Guidelines.

Best regards,

medicineworker
Oct 23 '07 #2
jamesd0142
469 256MB
Expand|Select|Wrap|Line Numbers
  1. if exists (select * from sysobjects where [name] = 'temp1')   drop temp1 
  2. Select <tablename1>.<column1> as  <name1>, <tablename2>.<column2> as <name2>
  3. inner join <table2> 
  4. on <table1>.<columnName> = <table2>.<columnName>
  5. into temp1
  6. from tbl1 as <tablename1>, tbl2 as <tablename2>
  7. order by <column>
  8. select * from temp1
  9.  
something along this, syntax is not correct
Nov 1 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: DC | last post by:
Is there a way to use a column alias in an another calculation within the same query? Since I am using some long and complex logic to compute total1 and total2, I don't want to repeat the same...
15
by: Pres | last post by:
I am not an experienced programmer. I do have a question regarding workday calculations. I have 3 fields. CURDATE, NUMDAYS, CALCDATE After entering the first two fields, normally the current...
2
by: Del | last post by:
Thanks in advance for any help. I have a database that was created in Access 2000. Several users have been upgraded to Access 2003. Since upgrading to 2003 we have noticed that some of the...
6
by: jimfortune | last post by:
In: http://groups.google.com/group/comp.databases.ms-access/msg/60d7faa790c65db1 james.ea...@gmail.com said: :Ok, I've answered the first half of my own question. From a MSDN :article, I...
6
by: sa_wahab | last post by:
Hi, 1. I want to calculate size of the record by mysql queries. Is it possible.. 2. What is the best way to calculate table record size which consists of Text type. Regards, @wahab.
1
by: gjoneshtfc | last post by:
Hello, I have an asp page that is a table. In the table the end column is a calculation of other values, for example: ...
19
by: LucasLondon | last post by:
Hi there, First of all apologies for the long post. Hope someone can offer some advice. I have about 200 columns of time series data that I need to perform a correlation analysis on in terms...
5
kcdoell
by: kcdoell | last post by:
Hello: I thought I was done with this one but a user who is testing my DB just pointed out a problem. I used the following in the afterupdate event: Private Sub...
1
by: csolomon | last post by:
I have an unbound text box which I use to get a calculation, called DM_SampleWt. This text box's control source is: =GetSize(,Nz(,0),.!,.!.(2)) I have written a function that will get the required...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.