i am trying this query
SELECT round( avg( DATEDIFF( CURRENT_DATE, age ) /365 ) , 1 )
FROM single_user U
INNER JOIN university_has_single_user T
ON T.single_user_users_id_user = U.users_id_user
where (
SELECT id_university
FROM university
WHERE university = "ISEL"
)
LIMIT 0 , 30
the output will be 26.8 but there is some problem because if i change the name of the university or simply remove the where clause the result is 26.8 again.
the dates are:
1979-06-23
1988-04-23
1988-04-23.
any help? what is the problem?
should be
Well, I guess. It’s not exactly clear to me wat your table structure is, and what you’re trying to achieve, but it seems to me that you want to get that number for a given university, passing its name to the query.
If I’m wrong there, please post your table structure and actual goal.