Table 1 has error messages with a variable number of numbered placeholders within squiggly brackets. I need to build the completed messsage with values from a 2nd table. Table 1: Table 2 The relationship between the tables is, of course, the error_id and placeholder/arg_seq_nbr values. A correct result would …
Group by one column and return several columns on multiple conditions – T-SQL
I have two tables which I can generate with SELECT statements (joining multiple tables) as follows: Table 1: ID Site type time 1 Dallas 2 01-01-2021 2 Denver 1 02-01-2021 3 Chicago 1 03-01-2021 4 Chicago 2 29-11-2020 5 Denver 1 28-02-2020 6 Toronto 2 11-05-2019 Table 2: ID Site collected deposited 1 Denver NU…
Update table with temp table only when values are different in the same columns
I want to update a table with contact data with data of a temporary table. Because there are a big amount of rows i have to update i just want the columns to be updated that have different values than …
Strange Query Plan for SQL Query – Clustered Index Seek
I’ve got a really strange issue with a Query plan generated for a very simple SQL query. The query is searching a full text index, and returning the count of records. For some reason, this SQL query is producing a Non Clustered Scan on an index, which I don’t believe it is optimal to do. I believe…
SQL Finding Missing Dates Between Ranges
I have a table of jobs that have ran for different source systems. These have a “RunDate” and then the FromDate and ToDate. I want to find the gaps where we are missing any dates in the …
how to sort recursive query in PostgreSQL
I have sql query to find all replies from orig comment: WITH RECURSIVE children AS ( SELECT blog_comments_comment.*, 0 AS relative_depth FROM blog_comments_comment WHERE id in %…
Oracle : Select only particular value from a row
I have a like below data : so i wanted to remove all the value after = and before | except for 1234. expected data : Answer You can use: Which, for the sample data: Outputs: VALUE 1234=A||1456=||1789= 1245=||1234=V 1234,1133 1456=||1234=1,234||1234 sqlfiddle here
Check value if exist in another table within Select Query
I have three tables first table stores user basic Info, the second table stores that user who exist in LDAP directory and third table store common information of both tables. below is the table structure I want name from a table if the value is not matched then check to another table. the desired output looks…
How to dynamically loop columns when `select where like` till result has only one row?
create table test(col1 int, col2 varchar,col3 date); insert into test values (1,’abc’,’2015-09-10′); insert into test values (1,’abd2′,’2015-09-11′); insert into test values (21,’xyz’,’2015-09-12′);…
calculate percentage/repartition of values with a sql query
I have the following table type color value A white true B black false c yellow true d red true f green false and I want to calculate with a sql query the percentage of rows having value equal …