|
Posted by alunev on 10/02/51 11:47
Thanks a lot, dude! will try that solution. The thing is, the two
tables that we want to join are quite big - one is 1.7 million entries,
another is 3.2 million. (working on a thesis in Finance)
I have been introduced to SQL less than a week ago, so can be quite a
lamer here. These are the DDL's for 2 tables
CREATE TABLE "public"."orders" (
"order_id" SERIAL,
"seq_id" INTEGER,
"datetime" TIMESTAMP(0) WITHOUT TIME ZONE,
"by_sell" INTEGER,
"price" DOUBLE PRECISION,
"volume" INTEGER,
CONSTRAINT "orders_pkey" PRIMARY KEY("order_id")
) WITHOUT OIDS;
Second:
CREATE TABLE "public"."transactions" (
"transaction_id" INTEGER NOT NULL,
"date" DATE,
"company_name" VARCHAR,
"trade_type" VARCHAR,
"volume" INTEGER,
"price" DOUBLE PRECISION,
"time" TIMESTAMP(0) WITHOUT TIME ZONE,
CONSTRAINT "transactions_pkey" PRIMARY KEY("transaction_id")
) WITHOUT OIDS;
Using posgres 8.1 Will wait for a friend of mine who is helping us
(the author of the question) to try the solution
But basically, we want to join orders with transactions, with field
price in transactions looking up PRECEEDING price in orders
Navigation:
[Reply to this message]
|