Category "sql"

Postgresql argument placeholder in jsonpath expression

I try to pass argument $1 to jsonpath-expression: SELECT 1 FROM %s.orders AS O WHERE order_info @? '$.items[*] ? (@.ProductID == $1)' but it doesn't work. P

Need help - Divide by 0 error in window equation?

I have the query below and keep getting a divide by 0 error but I'm not sure how to add something to bypass that select x.year, x.month, x.period, coalesce(

How to use group by and ordery by with some operation in SQL? [closed]

I have two columns price and sold_count for the product table. How do write sql query to find the top 3 shops having highest Revenue (calculat

Solution add textbox in SQL as string in vb.net

What is the solution if you see the code below there is a value (2000) then I want to change it to textbox so I can custom value. Thanks jack Dim sql As String

YYYYWW format in SQL Redshift

My company recently migrated to Redshift from Redash recently and I'm having a hard time recreating the YEARWEEK() function available in MySQL but not in Redshi

SQL Server - Combine two select queries

I have two tables, Semester1 and Semester2. Semester1: StudentId SubjectId abc sub1 def sub1 ghi sub1 Semester2: StudentId SubjectId abc changedSub1 def sub1

Query Optimization, changing the queries in the loop into a single processing query

How do I optimize these queries to be one or two? The one in the loop to be one at least. $applicantIds = \DB::select()->from( 'applicants' )->where( 'cre

How to remove the first word from a large string

I want to remove the first word from a large string in SQL Server. Input string: 931078027 BP 16:20:0:13 25 BAG 'B' CLASS Desired output: BP 16:20:0:13 25 BAG

I want multiple servers processing data from a single database table

I have a single database table on a relational database. Data will be loaded into it. I then want to have multiple servers processing that data concurrently (I

Extract all records from a JSON column, using JSON type

I have a couple tables (see reproducible code at the bottom): tbl1_have id json_col 1 {"a_i":"a","a_j":1} 1 {"a_i":"b","a_j":2

Finding duplicate rows in table with many columns

I have a table with 122 columns and ~200K rows. There are duplicate rows in this table. What query can I use to return these duplicate rows? Normally I would GR

How to transfer a filter to a query (TypeORM)

I want to get rid of the filter and put it in the request body. I tried using where, how can I do it? Questionnaire entity like: @OneToMany(() => LikeEntity,

Is there a best way to get data from snowflake to s3

Is there a best way to get data from snowflake to s3. ? the data snowflake shows will be in s3, but we don't have access to that bucket. And we only need to ge

Setting the values ​of a COUNT(*)

I'm using SAS and I'm stuck when I want to relay this in SQL : I have a column that counts the number of line repetitions : DUPLICATES | NUMBER | DATE ------

I connot able to filter the current user record using c# and MS Access DB

I connot able to filter the current user record. I want to display the data of current user only. But I did not understand how to handl query. here is the ss of

Convert columns to rows in Spark SQL

I have some data like this: ID Value1 Value2 Value40 101 3 520 2001 102 29 530 2020 I want to take this data and convert in to a KV style pair instead ID Val

How to fill a datagridView with my stored procedure on load

I have this stored procedure that selects the top 10 results from its inner join CREATE PROCEDURE SP_SELECT_DOCS_WHERE_JOBID_STATUS @JobID INT, @BatchID

Impala compare consecutive rows and insert identical row if there are no values

I have a table that gives me data every month and I need that range of time. I noticed that sometimes I don't have data for 3/4 month but I need to duplicate th

How to validate the date in a varchar column in SQL Server

I have a staging table which contains all varchar columns. I want to validate a date stored in the data column. Since my staging table contains all varchar colu

Impala compare consecutive rows and insert identical row if there are no values

I have a table that gives me data every month and I need that range of time. I noticed that sometimes I don't have data for 3/4 month but I need to duplicate th