Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Get the list of surveys having at least one answer

  • cavo789
  • cavo789's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 5 months ago #176432 by cavo789
Good afternoon


I'm searching to be able to create a query for getting the list of all surveys but only if they've at least one answer.


For getting all IDs, I use this SQL statement:

SELECT `sid` FROM `lime_surveys`


As far I've seen, the "how many answers" can be retrieved in the survey_[ID] table like


SELECT count(*) FROM `lime_survey_258978` WHERE submitdate IS NOT NULL

(as seen in the debug pane of the index.php/admin/survey/sa/listsurveys page)


Do you see any solution to write a single SQL like below i.e. without the need to loop on all my survey_[ID] tables


SELECT `sid` FROM `lime_surveys` WHERE (count_answers>0)


Thanks a lot
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose