0

This is my sql

SELECT
  date,
  name,
  post
FROM
  [dataset.table]
WHERE
  date='2019-05-01';

This is the error

Error: Argument type mismatch in function EQUAL: 'date' is type int32, '2019-05-01' is type string

3
  • 1
    provide example of your data specifically field date - as you see from error message - it is integer while you compare it with string thus the error. most likely your date looks like 20190501 or something similar - please clarify so we will be able to help you Commented May 2, 2019 at 6:41
  • i am getting this error after table partition Commented May 2, 2019 at 6:42
  • Row date name post 1 2019-04-01 vinay manager 2 2019-04-03 surbhi eng 3 2019-05-01 bhupendra test 4 2019-05-02 aniket sr.software.eng Commented May 2, 2019 at 6:44

1 Answer 1

2

Without a specific example for the format of data inside your date parameter this is impossible to give an exact working answer.

That said, you will need to specify that '2019-05-01' is a date, with date('2019-05-01').

Regarding your date parameter you will need to cast it to a date. Assuming it is currently formatted as an epoch timestamp the following will work: DATE(TIMESTAMP(date)).

So you would end up with something like:

WHERE 
    DATE(TIMESTAMP(date)) = date('2019-05-01')

It's worth mentioning that date is probably not a good parameter name.

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.