Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 8367

All versions of MySQL (not Microsoft SQL Server). Please also add a version-specific tag like mysql-5.7 if that is relevant to the question.

0 votes
1 answer
114 views

How to optimize a delete query with a subselect? [closed]

This query needs to delete over 17 million rows, from a table containing 20 million. DELETE FROM statements where agreement_id IN ( select id FROM agreements WHERE created < DATE_SUB(CURDAT …
stefgosselin's user avatar
0 votes
1 answer
40 views

How can one fetch subtotal in relation to a group by from an outer query?

I have a simple query, where I would like to display for past 7 days, grouped by hour from a table apiRequest: The count of request having a transaction vs the count of those having no transaction. …
stefgosselin's user avatar
0 votes
2 answers
1k views

How can one calculate percentage from previous week in aggregate query?

It goes as follows: mysql> SELECT -> DATE_FORMAT(s.created, "%Y-%m-%d") as "Date", -> count(s.id) AS "Accounts credited", -> sum(s.withdrawal) "Total Credited" -> -- 100 …
stefgosselin's user avatar
0 votes
1 answer
23 views

Getting aggregate sub-values in aggregate query

I have a query that need to show aggregated values in an already aggregated outer query. Consider a query that fetches total count of accounts being credited on a certain day. I would like to displa …
stefgosselin's user avatar