Category "sql"

Subtraction in same table in same row with where condition #SQL

Using a SQL query to subtract in same table: Table1 grade record total_amount ------------------------------ DSP receipt 17258 DSP sales 16

Can anyone help me on how to fetch MySQL table/s data in JSON format by querying itself which is similar to MS SQL Server

Below is the existing T-SQL code which generates table data in JSON format just by using the keyword FOR JSON PATH, include_null_value. How to implement the sam

SQL Pivot table?

Hi I am looking for a SQL Script the can pivot the following table Every values in ObjectClassProperty column must become columns. ObjectInstanceProperty will

How to use MAX function in MySQL with the having clause

I am working with the employees table in SQL and I would like to fetch the data for max count of employees SELECT (COUNT(emp_no)) AS emp_count, dept_no FROM de

Mapping only one row with JOOQ MULTISET

how to use MULTISET to map only one row rather than a list of rows. Classes: class User { private Integer id; private String name; private Integer p

PostgreSQL: How to add element to nested JSON array?

select rooms from users where username='test_user'; **returns** {"roomID":[{"1":"test1"}]} I want to add to[{"1":"test1"}] this {"2": "test2"} --> [{"1":"t

oracle insert on subselect gives ORA-00936

I am trying to insert into a table, whose values are same except few from the same table with max sequnce number based on an ID. insert into ENT_ROLE_USERS_HIST

How to get sum of multiple rows in a table dynamically

I am trying to get the total sum from columns of a specific data type(money) for multiple tables in a database. Currently I am able to get the list of columns f

Getting duplicate results from DB

let absent_remove = result_database.filter(item => item.absentday != absent_days) console.log("absent_remove", absent_remove); I got this piece of code, I h

Hive/ Impala query group by query for total success and failed record

I am trying to add the group by clause on the impala/Hive table but its not working. I am having the jobs details table which having job name and status column.

Is there a way to check what columns in one dataset exist in another dataset? sql

For example, I have table 1 and table 2, is there a way I can check the which columns from table 1 exist in table 2? Thanks!

Unnesting a big quantity of columns in BigQuery and BigTable

I have a table in BigTable, with a single column family, containing some lead data. I was following the Google Cloud guide to querying BigTable data from BigTab

Cannot drop table from schema

I am trying to use a simple "Drop Table" Statement in PL/SQL Developer on some tables, but they won't drop. The tables are quite large, but I've never had this

How to take dictionary and return a table with a row for each

I have a table like this, status_change is a dictionary, it has multiple status, How can i return a table: the dictionary key becomes the column header Appreci

Classify if a customer converted on initial email or reminder email using SQL

I have been stuck to get around this in Oracle SQL. I have a table that looks like following. cust_id event event_date camp_id email_ind(calculated column) 1 O

Is it possible to run a job with multiple stores running in it at the same time in SQL server?

I want to run 1 store multiple times like this in jobs. But somehow there is a problem that jobs only runs the first line of insert and the following lines do

Update the column in case of duplicate in mysql

So I am storing some config values in my table which looks like name value secret 1223 url "url" Now I have a situation where I want to update the secr

MariaDB converting datetime string to date

Trying CONVERT() Trying STR_TO_DATE() Trying CAST() - neither DATE or DATETIME work Trying CAST(STR_TO_DATE()) Hi, I cannot figure out what I'm doing wrong with

Missing right parenthesis in a Create sentence

I get this missing right parenthesis but I cant find it CREATE TABLE PUBLICACION AS (SELECT id AS id_revista, nombre AS nombre_revista, COUNT(C.dni) AS cuan

Passing dynamic table to ADO.NET Destination in SSIS

I'm having a problem with my dynamic table name in ADO.NET Destination. The control flow is: SQL Query that bring me all the tables I need from an OLE DB connec