tags:

views:

13

answers:

1
CREATE TABLE dtvs_risk_analizine_girmeme_tanimi_t
(
  id bigint NOT NULL,
  aktif boolean NOT NULL,
  price1 double precision,
  price2 double precision,
  priceoperator integer,
)
WITH (
    OIDS=FALSE
);
ALTER TABLE dtvs_risk_analizine_girmeme_tanimi_t OWNER TO postgres;

hello oll my table like on the up side. I have a price and I have many rules on the price column. I want to get all the column id value for my price value.

If priceopetaror is 0 then price1 is bigger then my price else if priceopetaror is 1 then price1 is smaller then my price else if ........

How I get all the row numbers for these rows.

+1  A: 

If you are wanting help building an if statement in sql

SELECT if(priceopetaror = 0, 'Bigger', if(priceopetaror = 1, 'Smaller', '')) as 'Some Column Name' from dtvs_risk_analizine_girmeme_tanimi_t

at this point you have all rows and a string containing what you have specified as your desired value. You can now add a where statement to the end of your query.

where priceopetaror = 0 or priceopetaror = 1

This will ensure you only get rows that have a value of 0 or 1

If you need additional assistance please post additional criteria.

Michael Eakins