pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Here is my problem
2+ messages / 2 participants
[nested] [flat]

* Here is my problem
@ 2013-08-09 14:20 Basavaraj <basava247@gmail.com>
  2013-08-09 14:38 ` Re: Here is my problem David Johnston <polobo@yahoo.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Basavaraj @ 2013-08-09 14:20 UTC (permalink / raw)
  To: pgsql-general

Now i want to insert data to the table....
the format should be

id | marks
----------
1  |50
1  |30
1  |30
....
....
2 |...
....

the actual query is 

insert into table(id,marks) values(1,unnest(array[marks])) 


But we should not use array and unnest but i want in this format

pls help..



--
View this message in context: http://postgresql.1045698.n5.nabble.com/Here-is-my-problem-tp5766954.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Here is my problem
  2013-08-09 14:20 Here is my problem Basavaraj <basava247@gmail.com>
@ 2013-08-09 14:38 ` David Johnston <polobo@yahoo.com>
  0 siblings, 0 replies; 2+ messages in thread

From: David Johnston @ 2013-08-09 14:38 UTC (permalink / raw)
  To: pgsql-general

Basavaraj wrote
> Now i want to insert data to the table....
> the format should be
> 
> id | marks
> ----------
> 1  |50
> 1  |30
> 1  |30
> ....
> ....
> 2 |...
> ....
> 
> the actual query is 
> 
> insert into table(id,marks) values(1,unnest(array[marks])) 
> 
> 
> But we should not use array and unnest but i want in this format
> 
> pls help..

Use the 

INSERT INTO tbl (...)
SELECT *
FROM src

form of insert to build and insert an entire dynamic result.

DavidJ.









--
View this message in context: http://postgresql.1045698.n5.nabble.com/Here-is-my-problem-tp5766954p5766960.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2013-08-09 14:38 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-08-09 14:20 Here is my problem Basavaraj <basava247@gmail.com>
2013-08-09 14:38 ` David Johnston <polobo@yahoo.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