Subject | How to multiply value with value from other table |
---|---|
Author | Zoran Zivkovic |
Post date | 2005-05-07T08:37:19Z |
Can someone help with this:
I have a folowing tables:
CREATE TABLE CENOVNIK (
EAPARTNO VARCHAR(15),
SP DOUBLE PRECISION
);
CREATE TABLE KURS_POREZ (
ID INTEGER NOT NULL,
KURS NUMERIC(15,2),
POREZ NUMERIC(15,2)
);
CREATE TABLE WATER_PUMPS_PARTS (
APPL_ID INTEGER,
PARTNO VARCHAR(9),
EAPARTNO VARCHAR(11),
DESCRIPTION VARCHAR(50),
PART_OE VARCHAR(16),
SEQ DOUBLE PRECISION
);
I would like to make query which should like something like folowing:
SELECT DISTINCT PARTNO
, EAPARTNO
, DESCRIPTION
, PART_OE AS OE
, (CAST ((CENOVNIK.SP*KURS_POREZ.KURS*KURS_POREZ.POREZ/1.00) AS
DECIMAL(15,2))) AS MPC
FROM WATER_PUMPS_PARTS, KURS_POREZ
LEFT OUTER JOIN CENOVNIK ON
(WATER_PUMPS_PARTS.EAPARTNO=CENOVNIK.EAPARTNO)
I would like always to multiply column CENOVNIK.SP with
KURS_POREZ.KURS*KURS_POREZ. Query is not designed in run time, but it
should
be fixed (something like I tried).
Table KURS_POREZ always has only one row.
The query I wrote doesn't return error, but also doesn't return any
result.
Please help.
Regards
Zile
I have a folowing tables:
CREATE TABLE CENOVNIK (
EAPARTNO VARCHAR(15),
SP DOUBLE PRECISION
);
CREATE TABLE KURS_POREZ (
ID INTEGER NOT NULL,
KURS NUMERIC(15,2),
POREZ NUMERIC(15,2)
);
CREATE TABLE WATER_PUMPS_PARTS (
APPL_ID INTEGER,
PARTNO VARCHAR(9),
EAPARTNO VARCHAR(11),
DESCRIPTION VARCHAR(50),
PART_OE VARCHAR(16),
SEQ DOUBLE PRECISION
);
I would like to make query which should like something like folowing:
SELECT DISTINCT PARTNO
, EAPARTNO
, DESCRIPTION
, PART_OE AS OE
, (CAST ((CENOVNIK.SP*KURS_POREZ.KURS*KURS_POREZ.POREZ/1.00) AS
DECIMAL(15,2))) AS MPC
FROM WATER_PUMPS_PARTS, KURS_POREZ
LEFT OUTER JOIN CENOVNIK ON
(WATER_PUMPS_PARTS.EAPARTNO=CENOVNIK.EAPARTNO)
I would like always to multiply column CENOVNIK.SP with
KURS_POREZ.KURS*KURS_POREZ. Query is not designed in run time, but it
should
be fixed (something like I tried).
Table KURS_POREZ always has only one row.
The query I wrote doesn't return error, but also doesn't return any
result.
Please help.
Regards
Zile