Category "sql"

How To Sum Count Result?

I have a database that will count daily total amount of customer that does or doesn't have a transactions. Customer Column is a varchar data type Here is how

How to select rows that are not in table B but they're in table A ( left join )

I'm using DB2 to develop an app, I have the tables products, price and cost, these tables store products data at this way: As you can see, for this example

How to convert hashbytes string from sql to spark equivalent

I have a process using the following select statement in sql server SELECT HASHBYTES('SHA1', CAST('4100119300' AS NVARCHAR(100))) AS StringConverted This give

Unknown column sql error while using jooq

Query: this.dslContext.select( ROLE.asterisk(), multiset( select(PERMISSION.asterisk()) .from(ROLE_P

Get only max values from table for each ID record [duplicate]

I am having table like this, where id is repeating several times. I need to get only max L1 value for each ID, so correct result from the que

SQL order of execution

I wonder how this query is executing successfully. As we know 'having' clause execute before the select one then here how alias name used in 'select' statement

Remove a piece from a string from a big database

I have a database like this and it goes on for like 2.7m more lines. Is there an SQL condition where I can remove the identifier from the titleurl in the whole

SQN Query has to return the clients of the user and the children of those clients

This is the query I have so far, which returns the customers of a user. But I need it to also return the children of these clients. SELECT c.id_client, c.uuid,

DELETE FROM + LEFT JOIN SNOWFLAKE

I'm trying to delete rows from table using delete. delete a from "table1" as a LEFT JOIN "table2" AS b on a."x" = b."x" where b."X" = 'X' but everything I ge

Unable to access data in Postgres query where clause

I am dealing with the following JSON in a Postgres database column called steps in a table called tCampaign : [ { "name":"Step 1", "stepRefe

Grouping Nested Query BY CASE OF ALIAS

I am trying to use a GROUP BY statement that would count each of the progress grades: SELECT with_avg.*, CASE when T_Points = Average then 'On Target' when T_P

Oracle SQL how to export null values

in relation with how to copy the records from output of oracle SQL developer to excel sheet I'm using Oracle SQL developer. I've some queries which get some nul

I need to group (tbl_types.name AS type) in a same row (postgres 14)

I need help with a select in postgres, I need to group X types into a single line, for example: type: multiple, trully, I need help on the type column SELECT tb

How Hibernate process '?' [duplicate]

I'm new in Hibernate. I can't understand how Hibernate process ? in Restrictions.sqlRestriction() method. For example, there is a sample from

Postgresql req.query returning everything instead of what is being queried?

My getByTitle query doesnt seem to work, all my other routes and models work perfectly using params. Not sure what it is I've written wrong? For context this is

How can I download all tags in the 'Posts' table?

If I write "select Tags from Posts WHERE Tags IS NOT NULL" on site https://data.stackexchange.com I can only download 50,000 rows. How can I get all rows?

SQL-how can i product/ multiply across partitions with window functions

The input I have is composed of the following columns: time, UseID, and value. I want to get the plt column as the product of successive numbers. I know about t

SQL User-Defined table Type in INTO statement

I want to Create a table @tablename with data from a User-Defined Table Type but I get the error Must declare the table variable "@tablename" ALTER PROCEDURE

SFMC date timezone

Can we convert Dataview Sent/Open CST date to UTC timezone without using dateadd funtion. Any other timezone related function?

Laravel Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) on a sub query with "ROW_NUMBER() OVER PARTITION"

I know there are tons of question that includes that error, but I haven't seen one that incldues a subquery with row_numbers. Ok so I have this raw query which