But if I add one more for my query (that not related to this), for example: I should get nothing (but it needs to be workable :D) Answer You can do a GROUP BY, and use HAVING to make sure all desired tag_id’s are there:
Tag: sql
How to Format phone number like 999-999-9999×1234567890 to 999-999-9999×12345 in oracle sql
If there is x in the given phone number, then after truncating there won’t be more than 5 digits after x. If there is no x in the phone number, then after truncating it will same Here is the possible situations How can I achieve this in oracle SQL using regexp_substr or any other methods Answer You can …
SQL query with meta_key,meta_value and have 2 conditions
I am trying to do an SQL query to find a form id of the Registration form of the user on a wordpress site, because this form doesn’t have the id of the user yet, I have to find the user email which is unique and check if the gdprchekbox-1 is true because it is only used for the registering
How to fetch single records using case statements
I want to fetch single record from the table test_table if any one of the value is null in the column e_value then it should print No else Yes My Attempt: Current Output: Expected Output: Answer you can use GROUP BY and COUNT: The count will return number of non-null values db<>fiddle here
SQL ‘insert into select’ into existing table
I wrote a simple insert into statement: I got this error: Cannot insert the value NULL into column ‘Worker_ID’, table ‘Worker’; column does not allow nulls. INSERT fails (By the way Worker.WorkingPlace is a nullable column) I’m very confused, because I’m just inserting data…
Merge/looping through an sql query with another query?
I don’t think my post title is correct/the best but I don’t really know how to concisely explain it. I have one SQL query This returns 600+ results I then need to run against every ID returned from the first query. Is it possible to merge these two queries together to return one table that looks l…
Changing In to Exists in SQL – with DISTINCT
Having this one: Reading this one: Changing IN to EXISTS in SQL Tried to change it into “Exists”, but produced this and it did not work: The error is 3706: Syntax error: expected something between ‘=’ and ‘DISTINCT’ keyword. Answer You have already redundant code. Inside th…
Informix doubly nested MULTISET remains empty
Given this schema: I tried running a query like this: But the output suggests that the inner most nested MULTISET query doesn’t work. The output is: Is this a known limitation or a bug? How can I work around this limitation? I’m using IBM Informix Dynamic Server Version 14.10.FC5DE Answer Just lik…
Internal error when lateral unnesting collection derived table in Informix
I’m playing around with what’s possible in Informix related to collection derived tables and nested collections. Given this schema: I tried the following query: Running it the first time from the Dbeaver SQL editor produces this error: SQL Error [IX000]: The current transaction has been rolled bac…
How to nest MULTISET in unnamed ROW in Informix?
Given this schema: The following query looks correct to me: But it produces some unspecified internal error: SQL Error [IX000]: User Defined Routine (collectionsend) execution failed. Is this a documented limitation? How can I work around this problem? I’m using IBM Informix Dynamic Server Version 14.10…