Skip to content

Instantly share code, notes, and snippets.

@mz0
Created May 7, 2020 18:00
Show Gist options
  • Save mz0/e18de9b49bb905bc3531a750feb78909 to your computer and use it in GitHub Desktop.
Save mz0/e18de9b49bb905bc3531a750feb78909 to your computer and use it in GitHub Desktop.
CREATE TABLE upMsg (
id int,
msg varchar(31)
);
insert into upMsg values (1, "Foo");
insert into upMsg values (2, "Bar");
CREATE TABLE dnMsg (
ni int not null auto_increment primary key,
id int not null,
reply varchar(30)
) ENGINE=InnoDB;
insert into dnMsg values (null, 1, "whatever, OK");
CREATE TABLE drMsg (
ri int not null auto_increment primary key,
id int not null,
error varchar(63)
) ENGINE=InnoDB;
insert into drMsg values (null, 2, 'no, no, no');
insert into drMsg values (null, 2, null);
select * from upMsg
left join drMsg using(id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment