Security group - view from group A but not from group B

is it possible for a user to have a profile to view records of a security group but not of another, being a member of these two groups?

in the tests I did the user has a group view profile, but he can see all the groups, I would like to restrict it to just a few groups.

Example:
Allowed to view from group A but not from group B

You have to use a combination of roles and security groups.

Check this post: Hierarchy implementation of the4 layers in suiteCRM using security groups