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 114172

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.

1 vote
2 answers
333 views

MySQL: Select rows, grouped by ID, where none of the rows have a value in a certain column

Confusing title, I know. Ii couldn't think of a better way to word it. Basically, I have a table like this: OwnerID | LotID | CurrentOwner The OwnerID is the unique key for the table. This value is …
Kevin's user avatar
  • 183
2 votes
Accepted

MySQL: Select rows, grouped by ID, where none of the rows have a value in a certain column

I was able to solve my problem with the following query: SELECT SUM(CASE WHEN o.CurrentOwner IS NULL THEN 1 ELSE 0 END) AS numNull, COUNT(*) AS total, …
Kevin's user avatar
  • 183
4 votes
3 answers
326 views

Complex joins with SUM

I am going to describe this problem as best I can. Hopefully someone can make sense of what I'm dealing with and can help me get out of this mess. This is a multiline, relatively complex query involvi …
Kevin's user avatar
  • 183
1 vote
1 answer
2k views

Mysql: Count, Group By, and limiting to first instance of an ID

I am trying to write a query to generate a report of sorts and I'm stuck on the logic of it. The summary of it is: I need to select the count of activities, where post_type is 'invoice' AND event = ' …
Kevin's user avatar
  • 183