SQL query returning same value for both tables colums
SELECT
(COUNT(v1.id) * 2) + (COUNT(v2.id) * 0.5) AS total,
COUNT(v1.id) AS votes,
COUNT(v2.id) AS visits
FROM
votes AS v1,
visits AS v2
;
Actually this query results in 1710 for votes and visits but votes has 18
rows and visits 98... Anyone know why? And has any solution?
The correct return values would be:
Total of 85
18 Votes
18 Visits
No comments:
Post a Comment