I want the result to display the amount of instances a particular service has been booked for. If the following row has the same service then they should be summed together. Sample Data Expected …
Tag: sql
SQL Query not return values
Im running a bit of SQL on my php app, its meant to return a value that gets compared to the value that does get returned. The query is returning two of the 4 values that i need. I’ve tried to …
PostgreSQL CTE UPDATE-FROM query skips rows
2 tables table_1 rows: NOTE: id 2 has two rows ———————– | id | counts | track | ———————– | 1 | 10 | 1 | | 2 | 10 | 2 | | 2 | 10 | 3 | ——–…
Count decline Attempts with CURSOR in Sql Server
Hi i am stuck at this problem, i have worked a solution through CURSOR in SQL SERVER but my rows are around 400K and output is taking hours, can anyone do this faster? maybe through CROSS APPLY or …
How can I update a column if another one is empty (but not NULL)?
I have this table in SQLite: clients —————– id name coords waypoint And whenever I set a waypoint for a client, I want to ensure that if they don’t have any value in column coords (I mean,…
Display parent records that meet condition of child records
In oracle sql, imagine I have a table of game developers and a table of products sold by a game store. Imagine I am trying to select only game developers that have a total amount of products …
Remove duplicates and fix foreign keys in T-SQL
I have the following tables: Foo_1 Id | Created | Dupe 1 | 2019-01-01 | ‘one’ 2 | 2019-01-03 | ‘one’ 3 | 2019-01-01 | ‘two’ 4 | 2019-01-02 | ‘one’ 5 | 2019-01-02 | ‘three’ Bar_1 Id | BarId …
How to compare two sets
I need to get all aid’s values which have cid != 40 and cid= 39 (many-to-many connection) I’ve prepared two queries but i don’t know how to except second from first SELECT DISTINCT aid FROM …
SQL Group rows in left join into one
i try create query with left join when i combine multiple rows into one. I try with GROUP_CONTENT function but when i try use it my db server is going down. I use MariaDB 10.3.17. I have tables like: …
sql delete statements with multiple where condition error
is this the correct statement if not plz help me correct it. String query = “delete from favourite where username=” + Session[“username”].ToString() + “and id=” + id;