I have a survey record table which I want to count the latest survey recoders with field 'complete' is''Y', while the latest survay name is in another table with the createdate, that's mean, the table name is dynamic,
select 'complete' count(*)
from(
select 'survey_name'
from survey
Where active=''Y''
order by cratedate desc
limit 1
)
but it cant work
record table: (name is dynamic)
id | complete | submitdate
survey table:
survay_name | active | cratedate
I knew it should be done by prepare statement, but my system (joomla + plotalot) only accept one query.