In below Hive-query, I need to read the null / empty “string” tags as well, from the XML content. Only the non-null “string” tags are getting considered within the XPATH() list now….
Tag: sql
Select where field1 or field2 or field3 is equal to a phone number
I am looking at a table with phone1, phone2 and mobile. However the phone strings are not formatted properly. The phone numbers are basically free text like this: row1: phone1:19123123123 row2: mobile:…
Is it possible to COUNT if one value occured more than the other value in a column using SQL
I have this table called task_status which has the following structure: CREATE TABLE `task_status` ( `task_status_id` int(11) NOT NULL, `status_id` int(11) NOT NULL, `task_id` int(11) NOT NULL, …
RUN IF ELSE STATEMENT in MYSQL to run different querys
I need to run a query with an if else statement(if possible in MYSQL) I want to: SELECT id FROM user_name_table WHERE user_name = @name; If the result of the query returns null i want to insert @name …
Extract number before and after character
I need to extract a certain number from my ‘TblA’ from column ‘Input’ in sql. I have the following example input and desired output 1 and 2. Input Desired Output 1 Desired Output 2 20 x 88 nc. 20 88 100 x 300 nc 100 300 200x 88 nc. 200 88 5x 300 nc 5 300 ol (200x 88nc.) 200
a query that sum the count of a row from multiple columns in SQL
I have to write a query that sum the count of a row from multiple columns My code is like this, but total doesn’t work: input: output: Answer Use coalesce as follows:
Select * Except particular properties in Cosmos DB with SQL API
Consider the following, I have a document that looks something like this: I want to get everything from the document EXCEPT $metadata and $version The obvious solution would be to: However, my document may expand dynamically, hence why the above is suboptimal. I therefore figured that it may be better to excl…
Is there a better way to execute this SQL query?
I have written this SQL query to get data for each customer in my database. As you can see, I’m trying to get the total of unpaid orders and the total of orders to my query. My goal at the end is to get only the users with unpaids orders (I think i will have to make it with a
Oracle: how to get unique combinations of 2 sets
sample data: Data looks like group: 1 set: 1,2,3 I want to get all combinations of this 2 tables but UNIQUE ( 1,2,3 it’s same as 1,3,2), so output would be like this: I tried using connect_by_path, but it get’s me or same combinations (like 1-132) or some combinations are missing. Any ideas? Answe…
Mysql how to write a query contains where followed by condition
I am writing one query, that needs to satisfy the following conditions. Because of the above issue currently writing two separate queries, which is not a good idea. Please help. Answer Unless I am missing something or over simplifying