Fixed sql statement for loading application data