Simple issue : I have fields (path) like : I want to be able to get the path containing 43/XX Meanings here the only valid one would be This seems not to be working Answer Only SQL Server supports using (a small subset of) regular expressions with LIKE. In MySQL, you would use RLIKE, or REGEXP (both are synon…
Tag: mysql
Shifting the total group by 1 step- MYSQL [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago. Improve this question Here I have name and pay as columns of a database table. Table has Name an…
Problem with Concat results searching in MYSQL
Hi this is the query I’m trying to achieve results with but how can I get the search for concat results in that column? Answer You can’t refer to an alias defined in the select clause in the same scope (left apart the order by clause). In very recent versions of MySQL (8.0.14 or higher), you can u…
MYSQL – Fetching entities whose many-to-many relationship contains all terms collectively
I am using the following DB Schema and using something like this to add data/query it which returns How can I return recipes who’s ingredients are a subset of a list of ingredients provided? e.g I should not return Chocolate cake if list (egg, salt, sugar) is provided. However I should return Chocolate …
SQL: Select Rows which does not have a corresponding userID in second table
I have 2 tables below : Messages On this table, for a particular Message, if it has a type ‘Q’ it’s a question. Else it’s a conversation from 2 users. Conversation Table This keeps a track of conversations and has questionuserid and answer userid Now from the table above, I would like …
MySQL select based on earlier row’s data (audit table)
I have an audit table that is structured as follows: This table is tracking whether we were able to successfully source a particular data point for a customer. Sometimes we are able to find the data on the first attempt, and you know this because there was no entry with a status of failed, the first occurrenc…
MySQL COUNT and IFNULL
I have tables like this: SQLFIDDLE I’m trying to count how many products are in each category SELECT `category_id`, `category_name`, IFNULL(count(*),0) cat_stat FROM `product_to_categories` …
Get all values from intermediate table
I have a mySQL three-table many-to-many setup with link table, simplified here: categories category_id category_name categories2entries category_id, entry_id entries entry_id entry_text …
I am missing an alias for a derived table
I know, this question has been asked very often but I know my error, I know how I could fix it, but I can´t find the point where the error is. In my opinion, all the subqueries have different and …
MySQL combine counts on columns from two tables
Is there a way to combine these two queries into one where table1.column1 = table2.column1 so that it would return the following? Answer Use subquerys and INNER JOIN