Category "sql"

LEFT JOIN to return only first row

I am making a join with two tables, tab_usuarios (users) and tab_enderecos (address). tab_usuarios structure: id_usuario nome usuario 1 Administrador admin 2 N

SQL Dynamic binding in a IN list [duplicate]

Curent situation Currently I have this PL-SQL script with almost fifty words "hard-coded": DECLARE categoryToSearch VARCHAR2(16); BEGIN catego

SQL Replace command with Regex

So I am trying to run this SQL command Select Replace('[1,2,3,47]','%[0-9]\,|\[|\]%',''); this regex should give the following result 47 however, the original

GCP Server crashing with "cloudsql.enable_instance_password_validation"

Over the past day I have been experiencing this error very frequently which results in the cloud instance needing to be reset in order to continue connections:

How to add Azure SQL server to Grid.js table data attribute

I've been struggling for a couple of days trying to link my Grid.js to Azure SQL database. My SQL database query function returns the data, but I can't link it

SQLite impute missing values by mean for every group

I have an SQLite table as shown below. students grades Nick 34 Nick 42 Nick 86 Nick Null John 38 John 12 John 74 John Null Colin 87 Colin 23 Colin 46 Colin 42

How to use more than 1 quotation using getRows method and .implode in sql Query, using PHP

I'm trying to get all records from db using getRows method, to achieve that I need to implode special characters. In previous function, to get $ids I used: fore

updating sql with php

I need to be able to update my sql table from open to close task. I already wrote code for this but it is not working properly. On the modal it shows 2 'continu

Druid generate missing records

I have a data table in druid and which has missing rows and I want to fill them by generating the missing timestamps and adding the precedent row value. This is

How to find time duration of ride given its starting time and ending time by using sql query

The start_on column in RIDE table is starting date and time for each ride and ends_on column is ending date and time of ride. i have to fetch the ride whose tr

Trying to separate sql DB values from each other

function absent() { const absent_date = new Date(); const absent_days = absent_date.getDay(); console.log("days", absent_days); let absent_remo

Sqlite - Return rows where some values are different

I have a large table a SQLite database of student exam results. Students often resit failed exams and subsequently pass them as shown with student 10001 below.

Storing a list of codes into a variable in Oracle SQL [duplicate]

There's a way to store a set of codes into a variable in Oracle SQL? I have these codes and I'll need to use them in different parts of my que

ORA-00936: missing expression - SQL pivot

Getting the above error in the IN statement. Can you anyone help? ORA-00936: missing expression 00936. 00000 - "missing expression" *Cause: *Action: Error

SUM UP two columns and then find the find MAX value in SQL Server

I am working with Microsoft SQL Server and want to find E_ID and E_Name where T1+T2 has the MAX value. I have two steps to reach the necessary result: Find the

SQL Server: Limit filling NULL values up to row with specific text

I have a CTE on which i am filling null values with the previous value before row 100 available by using the following script SELECT [YearMonth],grp, CASE WHEN

XML data at level 3/4 getting NULLs

I got my source data XML into snowflake stage tables. It's quite a complex XML document data for each record in the table. I got some of the elements using flat

Update date format in jsonb object in postgreSQL

Postgres table have one column as JSONB with below format { "steps": [ { "step": "Building", "status": "Complete", "end_date": "03/08/20

How can I apply a condition to multiple rows using SQL? CASE WHEN / PARTITION OVER

I am trying to create a column that shows Yes or No based on a set of conditions. If the conditions are met, then 'Yes' would apply to every row in the group (e

Function does not exist in PostgreSQL

I have this Postgres code CREATE PROCEDURE adjust_available(patientBed UUID) LANGUAGE SQL AS $$ UPDATE bed SET available = false WHERE bed.id = pati