1.11M Members

How do I store the output of a query in another table?

 
0
 

I have a table ...
Ratings (userid, movieid, ratings, time)
where ...
select count(*) from ratings where userid = X; (No of ratings of a particular user)

Here, X ranges from 1-6040!

How should I get the count of each user and then store it in another table 'Users' in the attribute 'countUsers' ?

Please help !

 
0
 

If you want to store the result into empty table:

INSERT INTO Users 
SELECT userid, count(*) 
FROM ratings 
GROUP BY userid
 
0
 

Creating view is a better option for that.

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article