I have a java program that uses SQL queries. The goal is to send them from my home PC to a workstation on a different network elsewhere. The SQL server is on Windows Server and I opened port 1433 for …
SQL query to fetch unique entries. Is the query correct and efficient?
The table structure is provided below. query used, desc p2p Output ‘auto_id’,’bigint(20)’,’NO’,’PRI’,NULL,’auto_increment’ ‘created_at’,’datetime’,’NO’,”,NULL,” ‘expiry_date’,’datetime…
Passing a column name as parameter to a stored procedure in mySQL
I’m creating some stored procedures to manage my DB. In particular, i want to create a stored procedore to edit a column, of a specific row, but i want to do it dinamically, passing the column name as an argument. That’s what i want to do Using the parameter keyi find the specific row in myTableth…
Group by time with postgres and jooq
How to group by minute, hour, day, or week in jooq. I have found out that in postgres we can use date_trunc(‘minute’, created_at) function for that. The simplified SQL I am using for that is: select …
#1241 – Operand should contain 1 column(s) In wamp on phpmyadmin
Nested query in Sql. SELECT *, (SELECT `supplier_sign_up_id`, ( SELECT email_address FROM supplier_sign_up WHERE …
DO while based on query result
I got a block of the code written in PHP it uses a DB connection to an Oracle DB, i need to run a query on a data and the result for the first query it should be an input of the next query and this …
Why I’m getting ORA-00979 while trying to use LISTAGG and LEFT JOIN?
I’m trying to group my results so, instead of looking like this: id | nome | bairro ——————— 1 . |Test 1 | bairro 1 1 . |Test 1 | bairro 2 2 . |Test 2 | bairro 3 It looks like this: …
What’s the best way to count the number of references based on conditions in both “home” and “away” tables?
I’m working on a project, and using Knex for it, (though if you give me raw SQL I’m pretty sure I can convert that as well.) So, here’s the sitch. I have tables ‘group’ and ‘user_group’. table ‘…
Recursively calculate product weights in product tree
I’m developing a software for Consumer price index calculation and one step of all calculation is to calculate product weights in product category. This should be done in SQL server side. I have MS …
SQL Windowing Ranks Functions
SELECT * FROM ( SELECT Product, SalesAmount, ROW_NUMBER() OVER (ORDER BY SalesAmount DESC) as RowNum, RANK() OVER (ORDER BY …