user19692465
user19692465

Reputation: 1

Spark SQL equivalent of SQL IN Condition

Im new on Spark, I need help on how I can use IN Condition in sparkSQL

SELECT name,age WHERE age IN (25,35,45) FROM table

Upvotes: 0

Views: 1861

Answers (1)

greenie
greenie

Reputation: 444

This should work df.where(col('age').isin([25, 35, 45)).select('name', 'age')

For reference, see the spark documentation

Upvotes: 1

Related Questions