I have USER table(master table) and ONLINE table(refrence table with one to one relationship with USER) like below:
I used left join on tables

I am applying order by on “is_logged” field of ONLINE Table.(ASC)
And I got the records in assending order, but all records are coming first which are not present in ONLINE table.
I want to all record of user table order but those records should be come last which are not present in online table
Check this out.
SQLFiddle Demo