I have two tables – first table is “projects”: p_id p_name 1 test1 2 test2 3 test2 4 test3 p_name is not unique The second table is “employee”: e_id jan feb mar apr may 1 2 2 3 3 4 2 1 1 3 3 2 3 1 3 2 3 3 4 4 3 2 3 4 I’d like
Tag: count
SQL: Use LEAD() and PARTITION BY to access to the next row following the current row
I have a mobile app browsing history dataset as shown below. DeviceDateTime: Date and Time the User views the page in the mobile app. UserID: each UserID represents a visitor who login the mobile app. PageName: There are different pages in the Mobile App. All visitors would first land on the Home page, and then navigate to different pages. PageSequence:
SQL: how do you calculate occupancy/ number of in-use for a facility?
I am trying to calculate the number of occupied lockers in the changing room. The dataset goes like this: My ideal output will be the number of occupied lockers per hour: I am able to manually calculate the number in excel (‘no. of check-in lockers during the hour’ + ‘no. of lockers in-use during the hour’ – ‘no. of check-out
How to check if all instances of a DB row are the same and if so count + 1 in SQL?
I have the following SQLite DB table: app | vendor | active ——————— 123 | AGX | 1 123 | OTMA | 0 123 | PEI | 0 255 | IYU | 0 255 | MAG | 0 255 | MEI | 0 675 | IUU | …
SQL Query to Find if (Count of date > X) = 0 For Group of ID
I apologize if the title is not be correct as I’m not sure what I need to ask for, since I don’t know how to build the query. I have the following query built to return a list of chemicals and other related fields. I am using this query in a VB.Net application where it exports the results to an
Running count SQL server
Can someone please help me in counting the rows in SQL Server Expected result Answer Try this:
Sql join with two tables max and count
i have two tables employee : employee_number employee_name salary divison_id division : division_id division_name How to Show division id, division name, number of employees working in each division that has the highest number of employees. I want to have an outcome like this : Answer
Need to modify a variable data to use as a “LIKE” in a COUNT query
I’m trying to use a numeric variable on a LIKE statement, but I do not know how to change the data to a numeric value. Before we start, I apologize because I can’t copy the table structure as I’m …
SQL select data grouped by attr1 with different criteria on attr2 and attr3
I have table with data like this in Access: I need result grouped by attr1, count attr2 and count attr3 only if value is “Yes”: I would appreciate any help with sql. Thank you very much in advance. Answer The expression for the third column is the challenge here. Consider an IIf expression: IIf(m.attr3=’Yes’, 1, 0) That expression will return
Count the amount of likes a user received on each post sql
I have two tables. Likes table which contains it’s like_id (PK), vole_id, user_id, and created_at timestamp. And another table called voles that contain vole_id (PK), and user_id, as well as a bunch …