The problem is where name_1 writes something to name_2 and name_2 writes something to name_1 there is a duplicate and as one result because I SELECT name_1, name_2 with condition How is it possible to show results with no duplicate rows, I only want to know if there is communication between user_1 and user_2 Answer Order the names in a
This Oracle SQL SELECT shouldn’t work. Why does it?
I am debugging a query in Oracle 19c that is trying to sort a SELECT DISTINCT result by a field not in the query. (Note: This is the wrong way to do it. Do not do this.) This query is trying to return a unique list of customer names sorted with the most recent sale date first. It returns an
Unpivot Access Data Table
Good afternoon, I would like to unpivot an Access Table. I have almost one hundred of columns in Access and one column with the ID and I would like to unpivot, considering all the columns except de ID into one column called “type” (for example). How could I get it from Access? It doesnt matter if is by a SQL
max DISTINCT returns multiple rows
I am working on an sql script which is executed by a .bat daily and outputs a list of IDs, the date of access, and their level. While it returns what I want, mostly, I noticed that some of the outputted rows are duplicates. Could someone please help me modify my script so that it outputs only one date (the
how to include 0 results in count with group by in HIVEQL
I’m a newbie in HIVE. I want to include 0 rows in results I have one table like this is my query example result is but my desired result is How can I get a 0 in results? Answer You can do this but you need to remove where clause. You can also do using self join. EDIT – I
Show column according to parameter
I’m trying to write a SQL script that shows a column based on a user parameter. I can’t find an acceptable answer anywhere. This is a simplified version of what I want to do (in OracleDB): The pseudo code of what I want could be This is the expected result: Answer You can just put the logic into the where
How to use not in / not like to compare values from different tables in SQL
I have SQL 2019 with these two tables – Orders and Customers with respective columns in Orders and in Customers. Order_comment is ntext type. I need to update the order_comment with customer_name value. The update should be something like this: If the customer_name is already part of the order_comment then the update should not happen. The above query works ok
Mysql TRIM/RTRIM/REPLACE doesn’t work to remove trailing spaces from an email column
I have this insert select statement, copying data from employee bulk add staging to employee table: Even if I change it to RTRIM or REPLACE(eb.tr_email, ‘ ‘, ”) to replace the spaces with nothing it will still not modify the data to be inserted. I cannot get my login to work since my backend application detects these trailing white spaces
SQL – Flag rows till 0 value of each group
I am calculating a running balance and want to flag all rows till 0 value to have ‘MATCHED’ flag else ‘NOT-MATCHED’ flag with respect to account ID. Here is what I have tried but didn’t got proper result: Answer We can use a sub-query to find the last acct_rank which is 0 and then use case to test each row.
Same ID with multiple records to single row
I have two tables. Table A look like this. source ID Type_ID Error_info ABC 100 1 country column missing ABC 100 2 conversion factor missing decimals BCA 200 1 error value in height column BCA 200 2 convertion factor should be 0.001 Table B look like this. source ID Type_1_ID Error_info_1 Type_2_ID Error_info_2 ABC 100 BCA 200 I want to