Hi all,
I am new here and want to know how to query the following:
I have tables users and a table news
the fields in news are text, photo, video
in text, photo and video columns the user_id from the users goes.
Now I want to display the list of all users order by the number of records they have in news table.
LIKE:
SELECT COUNT(*) as num FROM news WHERE text='$id_user' OR photo='$id_user' OR video='$id_user'
this query will give us which user has maximum number of records in news tables based on text, photo and video.
Actually I want to display the users in descending order based on the sum of of text OR photo OR video column.
Any help for this will highly be appreciated.
regards