this post was submitted on 30 Jun 2024
23 points (100.0% liked)

SQL

470 readers
1 users here now

Related Fediverse communities:

Icon base by Delapouite under CC BY 3.0 with modifications to add a gradient

founded 1 year ago
MODERATORS
23
Guess the intent (aussie.zone)
submitted 4 months ago* (last edited 4 months ago) by [email protected] to c/sql
 

I am one of the developers on a very small team and have just found the following query

I would love to hear your ideas for what you think was being attempted here!

SELECT ... FROM client WHERE CAST(ABS(SIN(clientId)) AS BIT) = 0

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 3 points 4 months ago

I forgot to mention this is in SQL Server, so SIN operates on radians. So I THINK this can only ever cast to a 0 when clientId is also 0

It certainly doesn't for any of the 100,000 existing rows