Your question is not very clear on all the naming conventions used and if any other details are there. Assuming this is the only table to store data and following naming convention means:
i_autoid = just an id (No idea why you have it... not needed!)
i_Friendid = id of the friend of logged in user
i_myid = id of the logged in person
Try:
SELECT
i_Friendid
FROM
tbl_friendmaster
WHERE
i_myid = @loggedInUserId
Now, above query gives all the friendid that are related to logged in user. Now, someone being online or offline must be tracked other way (and not through this table). You need to use the tracking online user with the query result to get
only online friends.
Try!