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. 756634 fiddles created (13595 in the last week).

create table accounts(account_id int, von datetime);
 hidden batch(es)


create table accounts_prop (account_id int, propname varchar(30));
 hidden batch(es)


insert into accounts (account_id, von) values (1,'2017-08-01'), (2,'2017-09-01'), (3,'2017-10-01');
 hidden batch(es)


select * from accounts;
account_id von
1 2017-08-01 00:00:00
2 2017-09-01 00:00:00
3 2017-10-01 00:00:00
 hidden batch(es)


insert into accounts_prop (account_id, propname) values (1,'pname1'), (2,'pname1'), (2,'pname2'), (3,'pname1');
 hidden batch(es)


select * from accounts_prop;
account_id propname
1 pname1
2 pname1
2 pname2
3 pname1
 hidden batch(es)


select a.account_id, a.von, ap.propname from accounts a join accounts_prop ap on a.account_id = ap.account_id;
account_id von propname
1 2017-08-01 00:00:00 pname1
2 2017-09-01 00:00:00 pname1
2 2017-09-01 00:00:00 pname2
3 2017-10-01 00:00:00 pname1
 hidden batch(es)


select a.* from accounts a where a.von >= '2017-08-25' and (select count(*) from accounts_prop ap where ap.account_id = a.account_id) = 1 order by 1,2;
account_id von
3 2017-10-01 00:00:00
 hidden batch(es)