I am looking to see if it is possible to compare field level security between profiles using a SOQL statement. Is this possible please?
Here is how you can get the Field Level Security for particular profile:
SELECT Id, Field, SObjectType, PermissionsRead, PermissionsEdit FROM FieldPermissions WHERE parentId IN ( SELECT id FROM permissionset WHERE PermissionSet.Profile.Name = 'System Administrator')
Depending upon the objects in your org, the above query would return number of records i.e. each record represents a field on each object. So for 20 objects with each of them having 20-50 custom fields it would return 20*50 number of records.
You can restrict the number of records by looking at a specific sObject. Ex:
SELECT Id, Field, SObjectType, PermissionsRead, PermissionsEdit FROM fieldPermissions WHERE SObjectType = 'Opportunity' AND parentId in ( SELECT id FROM permissionSet WHERE PermissionSet.Profile.Name = 'System Administrator')
Hope this helps.
I believe you can get basic info like filterable, updateable etc using the field portion of the DescribeSObjectResult. But, it is not complete and is only for the current user. If you really need to get this info using non-metadata methods, you might have to go to Andrew Fawcett's excellent metadata wrapper classes.