I have created a table with the following structure-
$sql = "CREATE TABLE followers
(
uid int UNSIGNED NOT NULL UNIQUE,
PRIMARY KEY(uid),
follower_count int UNSIGNED ,
is_my_friend bool,
status_count int UNSIGNED,
location varchar(50)
)";
I need to find the uid of the person with max(status_count+follower_count) and whose is_my_friend = 1
I wrote the following query but I ain't getting the correct uid.
SELECT p.uid FROM (select uid,is_my_friend,max(follower_count+status_count) from followers) p WHERE p.is_my_friend = 1;