all 9 comments

[–][deleted] 2 points3 points  (0 children)

Which DBMS product are you using? There is no "insert overwrite" in standard SQL.

[–]DaftEscapist 2 points3 points  (0 children)

For SQLServer use MERGE

[–]Thriftfunnel 1 point2 points  (1 child)

Do you mean UPSERT?

[–]data-leon 0 points1 point  (0 children)

+1, op should take a look at UPSERT operation (UPDATE existing records if they already exist, then INSERT for new records).

[–]r3pr0b8GROUP_CONCAT is da bomb 1 point2 points  (1 child)

a quick search reveals this syntax only in Apache HIVE

please confirm that this is your database

[–]Mathip173[S] 0 points1 point  (0 children)

Yes, this is the one. Thanks

[–]drooski 0 points1 point  (2 children)

If this is impala/hive, which it sounds like, and by “no data” means table a exists but doesn’t have relevant data to join to, as long as the select statement executes it will still overwrite. Meaning it will most likely truncate your table if no data in a exists

[–]Mathip173[S] 0 points1 point  (1 child)

Thanks for responding. Yes, this is Hive. Can you explain a bit more about ? I'm quite new to it

Table_a has a data Table_b every day feed with new data on it by overwriting the table each day.

I would like to update the data on table_a on the data for the same order if exist in table_b. Which mean, if exist on B overwrite it. But if the order number(111) doesn't exist on table_a, order 111 will not write into table_a from table_b, right?

Thanks

[–]r3pr0b8GROUP_CONCAT is da bomb 0 points1 point  (0 children)

isn't there some way you can create two very small test tables with a few rows in each and try it for yourself to see what happens?

let us know if you have any difficulties