Re: Insert data if it is not existing

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: tango ward <tangoward15(at)gmail(dot)com>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Insert data if it is not existing
Date: 2018-05-24 00:04:05
Message-ID: CAKFQuwa7JFd0ayELKnFD7KmmgNZxTLX_=KVBBqyzq50ngof0Pw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wednesday, May 23, 2018, tango ward <tangoward15(at)gmail(dot)com> wrote:

> Thanks masters for responding again.
>
> I've tried running the code:
>
> INSERT INTO my_table(name, age)
> SELECT name, age
> WHERE NOT EXISTS(SELECT name FROM my_table WHERE name= name)
>
>
> this doesn't give me error but it doesn't insert data either.
>
>
I'm doubting your assertion that it doesn't error. How do you run that
query such that age and name are recognized given the main query doesn't
have a from clause?

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2018-05-24 00:04:37 Re: Insert data if it is not existing
Previous Message tango ward 2018-05-23 23:58:50 Re: Insert data if it is not existing