Ok so I don’t think the question is as simple as the title suggests but here goes …
I have this query:
SELECT age.*, job.id FROM age, job WHERE ((age.aid = job.id) AND (age.aid='$id'))
this basically joins the two tables age and job and gets matching rows
but now I need to find the most common age stored in row guess under the table age
DB layout
Table: age
rows: aid – guess
Table: job
Rows: id
From what I have found searching I need to use count()
eg:
SELECT guess, COUNT(guess) AS countguess FROM age GROUP BY guess ORDER BY countguess DESC LIMIT 1
but how can I merge the 2 queries together?
You could do something like this