This is a sample of subquery used in Vertica Query which is a string generated from the application. There are some cases when this subquery becomes huge as the number of rows with UNION ALL increases. Vertica supports this query to some extent. But when there is let’s say 3000 + UNION ALL operator used…
MySql Group by but still show all rows
I have the following database ID imagename testresult sampleref uploadedat orderid 1 filename1.png NULL ABC123 2021-08-19 12:00 1002 2 filename2.png NULL ABC123 2021-08-19 13:00 1001 3 filename3….
Object cannot be cast from DBNull to other types with visual basic code
I have added dummy data to my SQL database. When I try to run the VB it comes back with a null error. What I have done is delete the dummy data from the database so it not reading the null value …
how to convert a column to an array in presto
Postgres provides a way to turn a column into an array. Samle query: WITH dataset AS ( SELECT ‘1’ as a union SELECT ‘2’ as a union SELECT ‘3’ as a ) …
SQL_Case and When
I have a data set where I need to calculate minimum amount due. I have used the below code SELECT *, Sales – Reversal AS Net_Sale, charge1 – charge1_rev AS Net_Fee1, CASE WHEN Net_Sale < 500 THEN …
Split the given column in oracle sql
I want to split the following table column {“senderName”:”John David”, “senderCountry”:”LKA”, “senderAddress”:”No 230,ABS,11200} I want to get …
Extracting date in SQL
I have a column due date in the format 20210701 (YYYYMMDD), using SQL I want to extract all the dates apart from 5th of particular month ( As highlighted in the pic below ) I used the below code: …
Compare table column with a range of values and take the position of that value from another table
I got stuck with this problem, please help if possible. Suppose we have two tables, Table A and Table B. Table A looks like this: And Table B looks like this: In table B we have around 23 values for each date, now we need to match val1 of table A to val2 of tableB for each date and return
Building and Grouping JSON Object in SQL Server
I have the following table and I’m trying to combine the rows into JSON objects. Username AccessKeys Marker user1 {“Account”:”1″,”Checking”:”0001″,”Loan&…
Count the sum of a left outer join table
I have two tables which is Student ID Name Gender Address 1 Abby Girl street 2 Mark Boy street 3 Lula Girl street 4 Bren boy street Lessons ID Lessons_code 3 MK2234 5 22324KL 6 KCS233 and I …