In Drosophila melanogaster, natural genetic variation in the foraging gene affects the foraging behaviour of larval and adult flies, larval reward learning, adult visual learning, and adult aversive training tasks. Sitters (for(s)) are more sedentary and aggregate within food patches whereas rovers (for(R)) have greater movement within and between food patches, suggesting that these natural variants are likely to experience different social environments. We hypothesized that social context would differentially influence rover and sitter behaviour in a cognitive task. We measured adult rover and sitter performance in a classical olfactory training test in groups and alone. All flies were reared in groups, but fly training and testing were done alone and in groups. Sitters trained and tested in a group had significantly higher learning performances compared to sitters trained and tested alone. Rovers performed similarly when trained and tested alone and in a group. In other words, rovers learning ability is independent of group training and testing. This suggests that sitters may be more sensitive to the social context than rovers. These differences in learning performance can be altered by pharmacological manipulations of PKG activity levels, the foraging (for) gene's gene product. Learning and memory is also affected by the type of social interaction (being in a group of the same strain or in a group of a different strain) in rovers, but not in sitters. These results suggest that for mediates social learning and memory in D. melanogaster.