By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
select version();
version() |
---|
8.0.27 |
create table BBS (FROM_ID int, TO_ID int)
insert into BBS values (1, 2)
insert into BBS values (2, 1)
insert into BBS values (1, 3)
insert into BBS values (1, 4)
insert into BBS values (1, 2)
select count(distinct(FROM_ID + TO_ID)) as "COUNT" from BBS
COUNT |
---|
3 |