I believe this is a simple question, but I’ve been searched around and got no satisfactory answer. Basically I have a Bigint object in MYSQL, I want to convert it to date format like 20201004, for example: I’ve tried But neither allow formatting, I hope to get the easiest and fastest conversion. Answer Assuming that your number is an epoch
Tag: string
MySQL – select distinct values from a column where values are separated by comma
To get the list of distinct values from table1 and column1 is as easy as doing this: However, I inherited (unfortunately) a database where column1 contains values separated by a comma I need to get the list of distinct values from column1, so it looks like this: Any ideas? Answer A generic method uses a recursive query (available in MySQL
How to format in PostgreSQL CITEXT variable to a regex to be used for search
First of all – all credits goes to Laurenz Albe answer here I hava a JSONB colum where I need to perform a search on the values (exactly as explained in the linked question). I think to get advantage …
postgres procedure list of values
I’m trying to pass in a list of values into a Postgres 11 procedure. The query has an IN condition. How do I pass in a list of values to the procedure & then how do I use it in the query? create …
Is it possible to use dynamic columns multiple times in a select?
I have some complex string replacement and I’m only permitted read-only access. I’d like to have several columns where each is dependent on the previous column so I can see if my substring and …
Why is my case statement not returning the value in my “else” clause?
I have this section of code and my ELSE is not working. It should return ‘UNKNOWN’ but I am still seeing NULLs in my results. What is going on? case when t2.NEURO_GRP_2 is not NULL …
How to convert MM/YYYY/DD format string to DATE in SQL Server?
I have a column for which I need to convert the data to DATE format. I receive below error whenever I encounter the data ‘MM/YYYY/DD’ format, but it works fine for other formats. Conversion failed when converting date and/or time from character string Sample data: SELECT ISDATE(’05/2020/29′) returns 1 but CAST or CONVERT functions fail. Answer That’s a weird format.
How to count SQL based on a DateTime and an other variable?
I have a SQL table with failed testresults: This table is telling me that the test has failed, but I want to know if it is the first, second or third test. In the end I would like to do it with a logo where a x stands for a failed test, and a X for the concerned test, like
SQL function to generate new row per event?
I’ve looked for an answer here to no avail; wondering if this problem is best suited outside SQL environment but thought I’d see how it could be solved. I’m trying to look at web journeys and as a result need my data to be in the following format: At present the data is in the following format: I essentially want
presto replace multiple characters
I have a string and would like to remove a set of characters. Is there a better way than chaining multiple replace()? I came up with the following but it requires a replace() call for each character: This is a minimal example and I have more characters to escape so I was looking for a less verbose way of achieving