Using sqldf() in R to create a df that fulfills a count distinct condition?

If you are equally new to R and SQL why complicate yourself using sqldf()? That approach is more useful if you already know SQL and you feel more comfortable doing data wrangling with SQL rather than R, an easier way will be to do it using dplyr but to give you specific advice it would be helpful if you could provide a minimal REPRoducible EXample (reprex) illustrating your issue.