Tag Archives: aggregate-functions
Combine two mysql COUNT(*) results, different columns
I’m trying to combine the counts for the following queries:
SELECT recipient AS otheruser, COUNT(*)
FROM privatemessages
WHERE sender = '$userid'
GROUP BY recipient
SELECT sender AS otheruser, COUNT(*)
FROM privatemessages
WHERE recipient = '$userid'
GROUP BY sender
…
If there Continue reading
Tagged aggregate-functions, mysql, php, sql
1 Comment
How to Update a column from the results of a SUM from other table column?
What im looking for is to update a column from table 1 using the results from the SUM of a different column in table 2 for example :
table 1
id | views |
--------------------
1 | 0 |
2 …
Tagged aggregate-functions, mysql, php, sql, sql-update
1 Comment
MySQL GROUP BY UNIX TIMESTAMP
I’m trying to fetch a number of rows from a MySQL database and group them by the day they were posted.
End result I would like the following..
Monday
-Article 1
-Article 2
-Article 3
Tuesday
-Article 1
-Article 2… Continue reading
Tagged aggregate-functions, mysql, php
1 Comment
Running queries on tables with more than 1million rows in
I am indexing all the columns that I use in my Where / Order by, is there anything else I can do to speed the queries up?
The queries are very simple, like:
SELECT COUNT(*)
FROM TABLE
WHERE user = …
Tagged aggregate-functions, mysql, php, sql
2 Comments
1 pages





