Skip to content

what this sign mean in sql query

i have the following code : What is /*_archive*/ mean ? in my database we have : Answer From a /* sequence to the following */ sequence, as in the C programming language. This syntax enables a comment to extend over multiple lines because the beginning and closing sequences need not be on the same line. MySQL…

select random COLUMN from PostgeSQL

I have a table which contains some links to photos in a few columns and I need to get a random photo from it. gives me a 3 links. But can I get only 1 random out of it? Answer You can unpivot. For instance: If the columns can ever be NULL, then you might want WHERE v.photo IS NOT

SQL DB2 Split result of group by based on count

I would like to split the result of a group by in several rows based on a count, but I don’t know if it’s possible. For instance, if I have a query like this : SELECT doc.client, doc.template, COUNT(…

Convert day of year & year to date Big Query

I have some data which instead of having a date field, contains the day of the year as a number and the year as a number in different columns. I have tried using big query functionality PARSE_DATE to achieve this by using PARSE_DATE(“%Y %j”, “2020 258”) but this does not work. When che…

Whats wrong with my query, should i use WHERE?

So, what am i doing wrong? This query: Will give me this error: Failed to run query: SQLSTATE[HY000]: General error: 1111 Invalid use of group function This query: Will give me this error: Failed to run query: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check …

SQL: Convert bigint type to formatted date

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. A…