pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedmathematical calculations - sql queries
3+ messages / 3 participants
[nested] [flat]
* mathematical calculations - sql queries
@ 2007-07-30 02:07 vbhatia@ksu.edu
2007-07-30 02:38 ` Re: mathematical calculations - sql queries Andres Olarte <olarte.andres@gmail.com>
2007-07-30 10:54 ` Re: [JDBC] mathematical calculations - sql queries Srinivas Kotapally <ksrinivas@coriendo.com>
0 siblings, 2 replies; 3+ messages in thread
From: vbhatia@ksu.edu @ 2007-07-30 02:07 UTC (permalink / raw)
To: pgsql-jdbc@postgresql.org
Hi all,
Thanks for replying to previous mail, I have one more question. Can I
write a postgresql query that retrieves a particular field from a table
and performs some mathematical calculation on that field involving
exponential( exp) and pow functions and storing the result in a new
table.
Somethign like this
select field1 from tablename1 ( performing calculation on field1 ) (
storing in another table)
Thanks and regards,
Vishal
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: mathematical calculations - sql queries
2007-07-30 02:07 mathematical calculations - sql queries vbhatia@ksu.edu
@ 2007-07-30 02:38 ` Andres Olarte <olarte.andres@gmail.com>
1 sibling, 0 replies; 3+ messages in thread
From: Andres Olarte @ 2007-07-30 02:38 UTC (permalink / raw)
To: vbhatia@ksu.edu <vbhatia@ksu.edu>; +Cc: pgsql-jdbc@postgresql.org
Sure, this is not a jdbc question, but it's fairly easy:
INSERT INTO table2 (col_name2) SELECT power(col_name1,3) FROM table1;
On 7/29/07, vbhatia@ksu.edu <vbhatia@ksu.edu> wrote:
> Hi all,
>
> Thanks for replying to previous mail, I have one more question. Can I
> write a postgresql query that retrieves a particular field from a table
> and performs some mathematical calculation on that field involving
> exponential( exp) and pow functions and storing the result in a new
> table.
>
>
> Somethign like this
> select field1 from tablename1 ( performing calculation on field1 ) (
> storing in another table)
>
>
> Thanks and regards,
> Vishal
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
>
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [JDBC] mathematical calculations - sql queries
2007-07-30 02:07 mathematical calculations - sql queries vbhatia@ksu.edu
@ 2007-07-30 10:54 ` Srinivas Kotapally <ksrinivas@coriendo.com>
1 sibling, 0 replies; 3+ messages in thread
From: Srinivas Kotapally @ 2007-07-30 10:54 UTC (permalink / raw)
To: vbhatia@ksu.edu; pgsql-admin
You could do a stored procedure for inserting into another table... Otherwise if
you want to get the result as a query, you could do something like,
Select field1, exp(field2) as expoffield2 from tablename1
Hope that helps,
Srini
-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org [mailto:pgsql-jdbc-owner@postgresql.org]
On Behalf Of vbhatia@ksu.edu
Sent: Sunday, July 29, 2007 10:08 PM
To: pgsql-jdbc@postgresql.org
Subject: [JDBC] mathematical calculations - sql queries
Hi all,
Thanks for replying to previous mail, I have one more question. Can I write a
postgresql query that retrieves a particular field from a table and performs
some mathematical calculation on that field involving exponential( exp) and pow
functions and storing the result in a new table.
Somethign like this
select field1 from tablename1 ( performing calculation on field1 ) ( storing in
another table)
Thanks and regards,
Vishal
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2007-07-30 10:54 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-07-30 02:07 mathematical calculations - sql queries vbhatia@ksu.edu
2007-07-30 02:38 ` Andres Olarte <olarte.andres@gmail.com>
2007-07-30 10:54 ` Srinivas Kotapally <ksrinivas@coriendo.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox