Question about nbt

Is it possible to check if a player has an item in his inventory with the count of a scoreboard? Im trying to see if a player has a diamond in his inventory but if he has an amount equal to a score.

Continue to help post