Tarscher
Tarscher

Reputation: 1933

perform operation on return value

I need to return measurement data from a database. Unfortunatly the data is in a different quantity (kWatt, I need Watt) and want to do the transformation preferably in the SQL statement

So I want to multiple the measuremententry with 1000 in

SELECT measuremententry FROM log

Is this possible?

Thanks

Upvotes: 1

Views: 88

Answers (5)

PeeWee2201
PeeWee2201

Reputation: 1524

SELECT measuremententry*1000 as measuremententry FROM log

Upvotes: 1

Kristof
Kristof

Reputation: 3315

You should be able to do

SELECT measuremententry * 1000 FROM log

Upvotes: 1

TyrantWave
TyrantWave

Reputation: 4673

SELECT measuremententry * 1000 FROM log

Works for me in PostGre, should work for you

Upvotes: 1

paxdiablo
paxdiablo

Reputation: 881653

How about something like:

SELECT kilowatts * 1000 as watts FROM log

Upvotes: 2

Mark Baker
Mark Baker

Reputation: 212422

SELECT measuremententry * 1000 AS measuremententry 
  FROM log

Upvotes: 2

Related Questions