Click to See Complete Forum and Search --> : How to use join two tables


mikezang
02-16-2008, 10:40 AM
I have two tables price and split as below, is it possible to select all data in table price with price after split in one sql?
Table Price
Code,Date,Open,High,Low,Close
9984,08/02/15,100,200,50,150
....
9984,05/12/29,200,300,100,150
9984,05/12/28,600,900,300,450
....
9984,04/04/25,1800,2700,900,1350
....

Table Split
Code,Date,Ratio
9984,05/12/28,3
9984,04/04/25,3

chazzy
02-17-2008, 10:40 AM
couldn't you just do...


select whatever_columns
from price inner join split on price.code=split.code and price.date = split.date

?

mikezang
02-18-2008, 08:01 AM
I hope that I can get data as below
Data,Open,High,Low,Close
08/02/15,100,200,50,150
...
05/12/29,200,300,100,150
05/12/28,200,300,100,150
...
04/04/25,200,300,100,150
...

price between 04/04/26 and 05/12/28 will be divided 3
price after 04/04/25 will be divided 9

chazzy
02-18-2008, 10:29 AM
why keep BL in the query?

if all of the columns are numeric, you should be able to use basic arithmetic to calculate it (using +, -, *, /)