skip to Main Content
SELECT * FROM userfeedback WHERE
    DATE LIKE '2020-07%' OR
    DATE LIKE '2020-08%' OR
    DATE LIKE '2020-09%' OR
    DATE LIKE '2020-10%' OR
    DATE LIKE '2020-11%' OR
    DATE LIKE '2020-12%' OR
    DATE LIKE '2021-01%' OR
    DATE LIKE '2021-02%' OR
    DATE LIKE '2021-03%' OR
    DATE LIKE '2021-04%' OR
    DATE LIKE '2021-05%' OR
    DATE LIKE '2021-06%';

Note : Here DATE is a column name which is of type Timestamp.

2

Answers


  1. If I understood correctly, you want to retrieve all the data from July 2020 until June 2021.
    Since you stated that the DATE datatype is timestmap, what you can do is the following:

    SELECT * 
    FROM userfeedback 
    WHERE 
      DATE >= '2020-07-01' AND
      DATE < '2021-07-01' 
    

    PS: I’d avoid using BETWEEN, since it can give undesired results when using Timestamps.

    Login or Signup to reply.
  2. here is one way :

    SELECT * FROM userfeedback 
    WHERE DATE between '2020-07-01' and '2021-06-30'
    

    side note : date is a keyword , better not to be used as object names (clumn name , etc)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search