0

I need to create data series with the value from 0 to 100 with a step of 0.1 Unfortunately, function generate_series() does not work with my database. does anyone know any other way to create a series like this? Thank you in advance.

4
  • 1
    I wonder the version of your DB... Commented Sep 17, 2019 at 19:52
  • 1
    Every Postgres version supports generate_series() - are you sure you are using Postgres? What does select version(); give you? Commented Sep 17, 2019 at 21:21
  • You are not using Postgres if you don't have generate_series(). Please correctly identify the database you are using. Commented Sep 18, 2019 at 1:38
  • Thank you very much. You are right. This is not PostgreSQL. This is Vertica Analitica database Commented Sep 18, 2019 at 6:04

1 Answer 1

2

One way is to use recursive cte:

WITH RECURSIVE CTE(c) AS (
  VALUES (0.0)
  UNION ALL
  SELECT c + 0.1
  FROM cte
  WHERE c <= 100
)
SELECT *
FROM CTE;

db<>fiddle demo

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.