+ 1

Can LIKE IN be used in sql in same query?

Guys will this work??? SELECT * FROM fname, city WHERE city LIKE IN (‘%c’, ‘%l’, ‘%l’, ‘t%) ORDER BY fname ASC; Will this work? Someone test it..

8th Apr 2018, 7:06 PM
Aakrit Shrestha
Aakrit Shrestha - avatar
3 odpowiedzi
+ 3
Are you sure LIKE IN exists? I can't find it anywhere
8th Apr 2018, 7:12 PM
Toni Isotalo
Toni Isotalo - avatar
+ 2
Yes, Toni Isotalo was right, there is no condition specified that way, LIKE and IN each defines their own specification, I never see them mixed up to define a condition so far, however, it is *perhaps* possible to use them both in a single query given each defines their own condition e.g. SELECT * FROM cities WHERE city_name LIKE '%io' AND province IN ('AB','CD','EF'); This I guess works : ) Hth, cmiiw
8th Apr 2018, 8:40 PM
Ipang
0
Yeah. I was just into the lesson when I had this question. Since with IN, one can scroll through multiple values (without using OR) and by LIKE, one can check the (t%). (Two birds with one stone, so I thought). May be isnt possible. Confused though.
8th Apr 2018, 7:16 PM
Aakrit Shrestha
Aakrit Shrestha - avatar