I have three tables: Person Dates Absence I need to find all of the person_id’s in the Person table and the date’s from the Dates table who have not booked any absence matching the following criteria: Dates.date_type = ‘PUBLIC_HOLIDAY’ Absence.absence_type = ‘HOLIDAY’ Basically, I need to find the people and the dates which are public holidays they have not booked
Tag: database
How to transpose column to row and duplicate the original column header?
I have a table for example as below, the alphabet is header and the numbers are its records a b c d e f ——————— 3 4 5 6 2 3 5 3 2 9 8 7 I want to …
Convert this SQL into eloquent ORM
I want to convert the following sql statement into eloquent: I did this as like below: The problem is that it is converting to the same sql but showing error. The error is shown below: * order_number, order_id, sum(quantity) as qty, sum(price) as pr from orders right join order_details on orders.id = order_details.order_id group by order_number) * The tables are:
Many-to-many sql select query containing multiple values, all values are taken into account
There is the following database structure: How do I write a query that returns only those Questions that have both CSS and JS tags?
Best technology for building race simulation application
I am trying to do something new, something I have never done before. I am looking for advice or point me into right direction how to choose technology. I am trying to build race simulation app that will have thousands of iot devices streaming data into central platform. While I understand that I can use some sort of IOT hub
Duplicate rows that belong to multiple groups before group by
Let’s say I have a table of customers and I want to group them depending on their first and last name and then get the mean age of each group. However, my rules are not mutually exclusive. For …
CS50 Pset 7 13.sql, I can’t solve it, nested sqlite3 database
DataBase movies.db tables directors (movie_id, person_id) movies (id, title, year) people (id, name, birth) ratings (movie_id, rating, votes) stars (movie_id, person_id) you can download the database. Question I’m new in programming, so I decided, to begin with, CS50 Harvard course here is the problem and the test solution: In 13.sql, write a SQL query to list the names of all
Group by not getting the expected results in mysql
I have the next query: That is working perfectly and returning 9 rows: I want to group the results by boat type and get the number of boats per type. However, when I do: I´m getting: but according to the first query, I´m expecting What am I missing? Answer I suspect that you want: That is: move the DISTINCT within
using condition for Group_Concat
I want to find all ids of which group_concat only contains ‘a’. Here is simplified table from mine. ╔════╦══════════════╦ ║ id ║ group_concat ║ ╠════╬══════════════╬ ║ 1 ║ a,b,b ║ ║ 2 ║ a …
Eliminate the rows that becomes same after swapping as in original table in SQL Server
I have a table which contains data as follows: I want a table which do not have Mumbai—>Jaipur as it is present already before being swapped. Similarly, Lucknow—>Indore is not required. All other entries must come as it is which is there in the existing table. Can any body help. Note: Table must not have any id or S.No. in