Super tricky question. I have a client wanting to output true/false based on a string sentence that represents a rule. E.g. if a rule is the string: “56 AND 78”, then this means “Return …
Tag: sql
Is there any way i can populate entity based on months but excluding the first month each loops?
i have a set of data sample like this | id | month | x | jan | x | feb | x | mar is there any way i can populate that sample to be like this? | id | month | number | x | jan | 1 | x | feb | …
count the 3 different values that a column can take
I’m trying to count the 3 different values that a column in a table can take, in a single SELECT. What am I doing wrong? I am using a postgresql table where the column named “tipoprova” is an integer Answer You are looking for filtered aggregation: Your query is wrong, because you have the wrong syntax for the CASE expression.
How to filter record with specific condition?
I have a table called post which contains Wordpress posts that have this structure: each zoacres-property post have a meta stored inside the meta table: I’m trying to filter the zoacres-property post by price, and I successfully did this using this query: which returns: this result is correct but, I would like to display all the property which have a
Count one column by considering another column
This is my Audit table: I need to write 2 different queries and I have no idea how should I write them: How many invoices do have ONLY product 2 (+ Total price)? How many invoices do have diffrent products but product 2 as well (+ Total price)? the result I want looks like this: Answer If I understand correctly,
How to query multiple conditions for one column in SQL?
I have three tables, one is book, the other one is category and last one book_category which has relation between book and category. In my situation I have books and their categories. For example one book can have multiple categories. How can query the books have both categories. For example, one book have novel and story categories, and other book
SQL DB structure for N items with M parameters varying over time
There’re the items: item_1 … item_N N is about a few hundreds. New items can be added sometimes. Each item has a set of parameters: parameter_1 … parameter_M M is about 20-30. These parameters …
How can I select one value from list
I would like to select one record if there are many status. example, if there is the same user and status A, B, C, select only record ‘A’. If there is the same user and status B, C, choose B, if there is only one status, bring that one. expected RESULT Could anyone help to suggest? Thank you Answer group
Match specific string before user input
I have the following strings: SDZ420-1241242, AS42-9639263, SPF3-2352353 I want to “escape” the SDZ420- part while searching and only search using the last digits, so far I’ve tried RLIKE …
Too many arguments passed to Stored Procedure storing image
I am trying to store a JPG image into a MSSQL Server 2014. The image path was being passed into a stored procedure and part of the process within the proc is to store the image into a VARBINARY(MAX) field (I cannot change schema). My first attempt was within the same proc like this: Even though the command that came