clear markdown compare help donate or buy diddy dollings comments/suggestions/bugs a leap of faith? bible365
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 809186 fiddles created (9664 in the last week).

create table docs(doc_text text);
 hidden batch(es)


CREATE TABLE tableA ( city text, street text, street_num int, val_x float, val_y float ); INSERT INTO tableA (city, street, street_num, val_x, val_y) VALUES ('CityA', 'Street abc', 5, 11.5, 0.5), ('CityA', 'Street abc', 5, 15.4, 1.8), ('CityC', 'Street klm', 55, 9.6, 0.8); CREATE TABLE tableB ( city text, street text, street_num int, val_x float, val_y float ); INSERT INTO tableB(city, street, street_num, val_x, val_y) VALUES ('CityA', 'Street abc', 5, 12.4, 2.8), ('CityB', 'Street xyz', 18, 5.4, 1.9), ('CityB', 'Street xyz', 18, 8.4, 1.1);
3 rows affected
3 rows affected
 hidden batch(es)


-- CREATE TABLE my_result AS SELECT DISTINCT ON (city, street, street_num) city, street, street_num, val_x, val_y -- more columns? FROM ( SELECT city, street, street_num, val_x, val_y -- more columns? FROM tableA -- WHERE ... UNION ALL -- here probably cheaper than UNION SELECT city, street, street_num, val_x, val_y -- more columns? FROM tableB -- WHERE ... ) sub;
city street street_num val_x val_y
CityA Street abc 5 11.5 0.5
CityB Street xyz 18 5.4 1.9
CityC Street klm 55 9.6 0.8
 hidden batch(es)