Category "sql"

How sum certain duplicated data?

I have a list of ids, some ids can be duplicated. How to sum values for the same id in one query? SELECT SUM(`power`) FROM `stats` WHERE `template` IN (489191,

why does it keep giving me errors?

SQL table: CREATE TABLE Application ( App_ID number(5), Child_Name varchar2(15) CONSTRAINT pk_Application_App_ID PRIMARY KEY, Child_Weigh

SQL query based on another table

I have tables like this: table 1: FNAME ID1 FID BREAD XYZ 18BREAD FISH ABC 45FISH BREAD_OLD BNQ 18BREAD_OLD BACON TBG 77BACON EGGS CGS 99EGGS BANANA BHG BANANA

Given a string path, find the leaf node

I am using this table and data where all children of a parent node are uniquely named. CREATE TABLE [dbo].[Resources]( [Node] [hierarchyid] NOT NULL, [N

SQL Consecutive value meet certain threshold [closed]

I have a table like below. Table A |id |value1| -- ------ |123| 89| |123| 8| |123| 90| |123| 6 | |123| 100| |123| 45| |12

Using this JS function, how can I store in a SQL database TMDB fields?

I'm currently developing a project that will be Client on Java and Admin on PHP. For this purpose, I would like to store the API's data in a SQL database, so th

Liquibase Formatted SQL and SQL Server Stored Procedures

My team is trying to get Liquibase-formatted SQL to work with SQL Server Enterprise. We have no problem creating tables, but whenever we try to create a stored

oracle insert o into timestamp column

I am having a csv file which contains 0 in timestamp column in source , when it is being inserted into oracle through informatica it is populated as NULL values

Whats missing on my Ruby 'Inverse Of' relationship

I know this topic has been addressed, but I have been at this for 2 days and I'm just stuck. I know inverse of does not create a new query, so should I use anot

count how many people who buy the same item at second time and how many people who did not buy the second item at second time (compare to firsttime)

Here is the question:count how many people who buy the same item at second time and how many people who did not buy the second item at second time (compare to b

How to select record in the database using BETWEEN in sql?

How to select record in the database using BETWEEN in sql? what I want here is to select record within the startDate and endDate. if the record is exists within

Presenting summary information with splitting the value of a column

Is there a way to bring up the following with the table below: customer_id | loan_date | loan_amount | loan_paid | status ------------+------------+-----------

Sap Business One sql query for "Open transaction stock report"

I would really appreciate if someone can build a query based on the requirements below: " This report asks the user to enter a stock item. Then it displays all

Joins on database engine vs on client-side [duplicate]

I am creating an API with express.js for a food app and I can't figure out what is the best (most efficient) way to query the data and send it

How to use WHERE statement on JSON stored in Presto SQL column to filter?

In Presto, I have data for a column in a table is as follows: header header 2 {Data: [{'item1': 'stuff1', 'item2': 'stuff2', 'item3': 'stuff3'}, {...}]} cell 2

Amazon Athena get data from the past one hour

I have some data rows in AWS Athena table and I am trying to get the data from the last 1 hour. I am using awswrangler, I will post my snippet below. Basically,

Return 0 if no row found in SQL Server using Pivot

Thanks everyone, and thank you @Aaron Bertrand, your answer solved my problem :) ! i am struggling to find a solution to my problem, here is my query in SQL Ser

Removing white space in column values of SQL o/p

Not able to remove white space from SQL query output used in pyspark code. I tried, trim,ltrim,rtrim,replace (multiple nested also) and regex replace. Any other

Total up transactions

I am using SQL Server Management Studio v18. I have an original transaction that might get adjusted either by amount or by commission%. I want a query to total

How do I create an array from a grouping of row_number()?

I have code that uses row_number() partitioned by date. I would like to create an array that contains data grouped by the row_number that is partitioned by date