'How do i make an SQL statement display a name starting with certain characters without using the LIKE function
I tried this code to display names starting with J, S, or M without using operator.
but it gives one problem, it is wrong statement since it isn't about first character in the name, its showing results of names with the characters anywhere in the name.
How do I fix this?
FROM Student
WHERE InStr(Stud_name, "J") OR InStr(Stud_name, "S") OR InStr(Stud_name, "M");```
Solution 1:[1]
Options:
Left(Stud_name, 1) = "J" OR InStr(Stud_name, 1) = "S" OR InStr(Stud_name, 1) = "M"InStr(Stud_name, "J") = 1 OR InStr(Stud_name, "S") = 1 OR InStr(Stud_name, "M") = 1Left(Stud_name, 1) IN ("J", "S", "M")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | June7 |
