Skip to content
Advertisement

Tag: select

How can I run this SELECT query?

I’m working on a Messaging feature for an application, and I have a the following tables in MSSQL, along with a User table (not listed): I want to query the ThreadParticipant table for whether or not a thread exists containing only a given set of user ids, let’s say users 1,3,5,7. Each Thread contains a unique set of user ids.

Count rows with same value while keeping columns

Lets say i have the following sql table: How can i modify my select query to return my data with an additional column telling me the number of occurrences for each ID, while keeping the original columns collected? Which would result in this: Query is this: Answer You can use window functions, if your database supports them. What you ask

Selecting variables as individual rows in table [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 2 years ago. Improve this question

How to group by multiple rows and column

For each user 3 codes are there(10,20,30) if all codes(10,20,30) are true then it has to JOINED if any codes(10,20,30) are False then it has to NEGLECTED WE have to check max(date) Table is below: Output user2 and user3 is JOINED, user1 is NEGLECTED Answer I assume that the column bool is of data type BOOL, so you can do

How to modify result of select statement based on values?

I am not MySQL guy just learning by doing things, I have database that stores value 0 or 1, now in grafana I want to display online if value yield from select statement is 1 and offline if value of online in select statement is 0. So far this is what I wrote But select statement through error. Answer You’re

Advertisement