Google BigQuery error: No matching signature for operator >=

404

David-Spring

posted on

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds




 SELECT SUBSTR(CAST(CURRENT_DATE AS DATE) + (CAST(d1.digit*10 +d2.digit AS INT64)-11)) AS Calendar_Date

, SUBSTR(CAST(CURRENT_DATE AS DATE) + (CAST(d1.digit*10 +d2.digit AS INT64)-11)) AS Financial_Date

FROM

( SELECT '1' as digit1

UNION ALL SELECT '2'

UNION ALL SELECT '3'

UNION ALL SELECT '4'

UNION ALL SELECT '5'

UNION ALL SELECT '6'

UNION ALL SELECT '7'

UNION ALL SELECT '8'

UNION ALL SELECT '9'

UNION ALL SELECT '0'

) d1

CROSS JOIN

( SELECT '1' as digit2

UNION ALL SELECT '2'

UNION ALL SELECT '3'

UNION ALL SELECT '4'

UNION ALL SELECT '5'

UNION ALL SELECT '6'

UNION ALL SELECT '7'

UNION ALL SELECT '8'

UNION ALL SELECT '9'

UNION ALL SELECT '0'

) d2

WHERE CAST(d1.digit1*10 +d2.digit2 AS INT64) <=20

)

For above query i'm getting this error

Can you please help me out

No matching signature for operator * for argument types: STRING, INT64. Supported signatures: INT64 * INT64; FLOAT64 * FLOAT64; NUMERIC * NUMERIC

You get this error when you perform a multiplication between an integer column and string. The solution is to do an explicit casting. convert the below line from :

WHERE CAST(d1.digit1*10 +d2.digit2 AS INT64) <=20

to

WHERE ((CAST(d1.digit1 AS INT64)*10) + CAST(d2.digit2 AS INT64)) <=20