I am new to the site and SQL. I need some help with a case expression. The requirement is as follows: I have a table T1 with two date columns – eff and disc; A second table T2 with 2 date columns -…
Error 1064 when using SQL with INSERT INTO … SELECT … ON DUPLICATE KEY UPDATE
I am trying to use ‘INSERT INTO … SELECT ON DUPLICATE KEY UPDATE feature’ but I’m in trouble now. I want to insert data to ‘fruitProperty’ table. My query is as below: START TRANSACTION; SET @…
Count of past instances in an appended table
This is my desired output: ‘CountOfUsersBought’ I want it to be Amongst All Targeted Users. And the Table (Updated Daily) from where I get the data to fill the previous output has the following structure: I want to store on the variable ‘CountOfUsersBought’ the count of all the users t…
Create parent/child relation in SQL server based on the below scenario
In this picture, 2018_9UKDT – UKD Expense Total is parent of 2018_9Q400 – UKD Indirects and this in turn is parent to 98064 – IT SDS Costs, 98063 – ACS in charges, 98012 – UKD …
android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed:
Error FATAL EXCEPTION: main Process: com.appmaster.akash.messageplus, PID: 14373 …
Write a query to show ename who don’t have reporting manager in deptno 10 or 30?
This is the emp table given in Oracle SQL. And I need to display the employees who don’t have reporting manager in department 10 or 30. Answer I would use not exists:
Get query result 15 second interval in Oracle
I have following query to get 15 seconds interval. However I want to show also ‘0’ values even if the result doesn’t have value. Here is the Query; select to_char(trunc(sample_time,’hh24′) + (trunc(…
How do I get a value from XML column in SQL?
So, I have a table with a large chunk of data stored in XML. The partial XML schema (down to where I need) looks like this: …
Join two tables on id fields using Impala
I have two tables in in HDFS that I want to join using Impala. One is Employee_Logs the other is HR_Data. Queries: select e.employee_id, e.action from Employee_Logs e where e.employment_status_desc …
Mysql : can’t figure out what’s wrong with this LEFT JOIN query
I would like to do a left join on the same table (licence) that only gives me licences that have no entry in the joined table. But I can’t get any result 🙁 Here is the query (quite simple actually) …