Mysql – SQL get rows where sum of col value is bigger than X
I have a table like this: id date capacity depot reserved order_id 1 2024-04-29 69 1 0 0 2 2024-04-29 49 1 0 0 3 2024-04-29 69 1 0 0 4 2024-04-29 69 1 0 0 Now I want to…
I have a table like this: id date capacity depot reserved order_id 1 2024-04-29 69 1 0 0 2 2024-04-29 49 1 0 0 3 2024-04-29 69 1 0 0 4 2024-04-29 69 1 0 0 Now I want to…
I am trying to understand any limits (either exact or practical) that exist on the number of partitions for a single Postgres database, and any performance concerns that arise as you approach these limits. To this end, please answer the…
test_run_id test_id suite_id exe_length message 4201 32 39 11 Hub Status does1 4201 32 39 17 Hub Status does3 4201 32 39 17 Hub Status does4 4201 32 39 18 Hub Status does7 4200 32 39 11 Hub Status does8…
while studying about the As statment i get to knwon it is executed at the end of the uqery so if in case i am trying to use the alisd name i have created in a query like select film…
I have this query: SELECT u.id, u.service, u.subscription_date FROM user u WHERE EXISTS ( SELECT 1 FROM user u2 WHERE u2.subscription_date = u.subscription_date AND u2.service = u.service GROUP BY u2.service, u2.subscription_date HAVING COUNT(*) > 1 ); My issue is that…
I have a log table that tracks updates, structured like this: CREATE TABLE user_log ( name_id VARCHAR, modified DATE, -- Other fields... ); I aim to implement a unique constraint based on the name_id, ensuring that only the most recent…
Select CONCAT ( Name, '(' , LEFT(occupation,1) , ')' ) FROM occupations UNION Select CONCAT ('There are a total of ', Count(Occupation) ,' ', occupation, 's' ) as line FROM occupations Group by occupation ORDER by line Why can I…
I have this table with the next records: CREATE TABLE `t_vias` ( `id` int(11) NOT NULL, `cpro` varchar(2) NOT NULL, `cmum` varchar(3) NOT NULL, `cpos` varchar(5) NOT NULL, `mun` varchar(75) NOT NULL, `via` varchar(100) NOT NULL); INSERT INTO t_vias VALUES…
I have rows containing Json like: [{"Qty": 1, "Amt": 2.99},{"Qty": 3, Amt": 4.50}] How do I get a sum of Amt per row? Reproduction Code: DROP TABLE IF EXISTS dbo.SqlQueryResults; CREATE TABLE dbo.SqlQueryResults( Id INT, Result nvarchar(max) ) GO INSERT…
I ma trying to create json file from SQL table using ADF through Stored Procedure Stored Procedue: SELECT ( SELECT * FROM [dbo].[TEST_TABLE] FOR JSON PATH, INCLUDE_NULL_VALUES ) AS json_file; I am then trying copy activity where Source is SQL…