
take the above as the output of the sample table, I need a sql query that results in "2" as the amount from the table.
I tried to do this while the column sent to 4, and everything was fine; but the other lines display the wrong o / p value. my old code is specified
SELECT COUNT(*)/2
FROM
(SELECT sentby,sentto
FROM
(SELECT DISTINCT sentby, sentto FROM count_temp)
WHERE sentto IN
(SELECT DISTINCT sentby FROM count_temp )
AND sentby IN
(SELECT DISTINCT sentto FROM count_temp )
) ;
Thanks in advance and thanks.
source
share