Because it should be active_realm_id instead of realm. The following should fix it.
diff --git a/src/mangosd/CliRunnable.cpp b/src/mangosd/CliRunnable.cpp
index 1f11037..549d578 100644
--- a/src/mangosd/CliRunnable.cpp
+++ b/src/mangosd/CliRunnable.cpp
@@ -483,7 +483,7 @@ bool ChatHandler::HandleAccountOnlineListCommand(const char* args)
///- Get the list of accounts ID logged to the realm
// 0 1 2 3 4
- QueryResult *result = loginDatabase.PQuery("SELECT id, username, last_ip, gmlevel, expansion FROM account WHERE realm = %u", realmID);
+ QueryResult *result = loginDatabase.PQuery("SELECT id, username, last_ip, gmlevel, expansion FROM account WHERE active_realm_id = %u", realmID);
return ShowAccountListHelper(result,&limit);
}