I have a doubt regarding one of my issues:
I have two tables: users and network
- In user table, I have user information
- In Network table I have information of the connections have been made on our platform
In Network table, the records have been added as 1 (user_id) got connected with 2 (member_id) and 2 (user_id) got connected with 1 (member_id) - i.e there is a single connection made on our platform but the entry in the table occurred twice. Some of the records have only one entry in the database. So, I can't assume that the half number of records will be our exact answer.
How can I consider these two record as the same one?
A query which I have written is:
select count(*), month(A.created), year(A.created), A.created from (select t1.* from vt_network_members t1 where (select count(t2.id) from vt_network_members t2 where t2.user_id = t1.member_id and t1.user_id = t2.member_id and t1.id > t2.id) = 0 and t1.user_id != t1.member_id) as A
group by month(A.created), YEAR(A.created)
order by YEAR(A.created), month(A.created)