score:2
Accepted answer
Since you made it clear that you are trying to update a column in another, you need to utilize an update statement, not an insert. I went ahead and edited the answer.
Try This:
UPDATE inland SET lt_dispatch_level = obs.named_lt_dispatch_level
FROM obs WHERE obs.created_at = (SELECT MAX(created_at)
FROM obs) AND inland.cartodb_id = 1
The query should return you with the latest row.
More questions
- SQL Insert newest value from another table
- SQL Query to insert values from one table into another
- PostgreSQL wiht pg8000 - INSERT results from an SQL to another table
- How to select many rows from 1 table and insert into a specific JSONB field of a specific row in another table? But in a single raw SQL query
- Postgresql SET DEFAULT value from another table SQL
- Update SQL rows from another table and a static value
- Postgres upsert (update and insert ) from another table successfully,but id value getting duplicated for one value
- SQL For each value from a table, execute a query on another table depending on that value
- Insert a value from a table in another table as foreign key
- Insert value into a table when strings match conditions from another table
- Postgres: insert value from another table as part of multi-row insert?
- how to efficiently locate a value from one table among values from another table, with SQL
- Postgres refuses to insert timestamp value from one table to another table
- Insert aggreated data from one SQL table to another (Postgres)
- SQL Query: How to send MIN value from one table to another based off ID
- Insert multiple data from subquery into another table in postgres sql
- SQL Alchemy insert into table, with column being selected from another table
- How can I insert a value from another table to another on insertion?
- Update a Postgres table columns values from another table if same values otherwise insert a new row for unmatched value
- Insert value into table from another table mybatis xml
- Export specific rows from a PostgreSQL table as INSERT SQL script
- SQL update fields of one table from fields of another one
- PostgreSQL: insert from another table
- PostgreSQL - insert rows based on select from another table, and update an FK in that table with the newly inserted rows
- How to make PostgreSQL insert a row into a table when deleted from another table?
- duplicate key value violates unique constraint - postgres error when trying to create sql table from dask dataframe
- Copy value from other table on insert trigger, postgres
- How do I insert into a table from another table by matching on values?
- How to INSERT a reference to UUID from another table in PostgreSQL?
- Get text[] value from sql table with FireDAC on Delphi
More questions with similar tag
- Flyway repeatable migration for a view can't be dropped
- Rails 5 Generate devise with already created user table in PostgreSQL
- Hijri Date Inserting to the Database
- Unable to insert into table where column is a foreign key
- Query to combine two tables into one based on timestamp
- Is SELECT or INSERT in a function prone to race conditions?
- Datatables postgres duplicate rows paging
- Delete functionality with spark sql dataframe
- How to view available postgres users, without having a user to log in?
- How to insert a python list into Postgres table
- Read PostgreSQL data directory files
- delete all but two sorted items postgresql
- How to alter a postgres datetime column to default to datetime.utcnow
- Can't set default value for column
- Count freuency of array or jsonb object
- Json operator doesn't seem to work with variable
- Hstore Query to find records matching with any array element using ruby on rails
- Parse string as json array from Postgre
- How to restart PostgreSQL in Ubuntu 18.04
- retrieve data from online database using input file
- Rails 4 ActiveRecord has_many through relation
- Problem restoring databse between 2 RDS instances using pg_dump and pg_restore
- Join two queries to form one table - in postgres
- Update only time in timestamp postgresql
- Postgres: Using ON CONFLICT together with CASE
- PostgreSQL 9.3: Display result in specific format using array_agg function
- Spring reactive programming and relational databases: using relationships
- Rails: How to store a JSON object from a form and query it?
- Postgres DB query retrieval efficiency with django
- PL/pgSQL: How to get variable's / parameter's name? [postgresql]
Source:
stackoverflow.com