Combining in and like
-
I'm still relatively new to SQL and I was wondering whether there was an easier way to do things. I need to limit a query based on if a field is like one of three values. I can use "WHERE field in ('list one', 'list two', 'list three')", and I can to "WHERE field like 'list one' or field like 'list two' or field like 'list three'". Is there a way, however, to combine 'in' and 'like' to do something like "WHERE field in like ('list one', 'list two', 'list three') ?
-
I'm still relatively new to SQL and I was wondering whether there was an easier way to do things. I need to limit a query based on if a field is like one of three values. I can use "WHERE field in ('list one', 'list two', 'list three')", and I can to "WHERE field like 'list one' or field like 'list two' or field like 'list three'". Is there a way, however, to combine 'in' and 'like' to do something like "WHERE field in like ('list one', 'list two', 'list three') ?
Drew McGhie wrote:
WHERE field in like ('list one', 'list two', 'list three')
That sounds like Valley Girl SQL. :-D You should post this to the SQL forum, you'll probably get more and faster responses than in the C# forum. :josh: My WPF Blog[^]
-
I'm still relatively new to SQL and I was wondering whether there was an easier way to do things. I need to limit a query based on if a field is like one of three values. I can use "WHERE field in ('list one', 'list two', 'list three')", and I can to "WHERE field like 'list one' or field like 'list two' or field like 'list three'". Is there a way, however, to combine 'in' and 'like' to do something like "WHERE field in like ('list one', 'list two', 'list three') ?
No you can't do that. You would have to say where (field like '%list1%' or field like '%sdf%') but that would be inefficient anyway. how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things --thedailywtf 3/21/06
-
Drew McGhie wrote:
WHERE field in like ('list one', 'list two', 'list three')
That sounds like Valley Girl SQL. :-D You should post this to the SQL forum, you'll probably get more and faster responses than in the C# forum. :josh: My WPF Blog[^]
Josh Smith wrote:
Valley Girl SQL
Sweet :) UMM LIKE CREATE PROCEDURE Procedure1 ASIF SELECT LIKE ALL OF Table1, DUH UHH GO
-
Josh Smith wrote:
Valley Girl SQL
Sweet :) UMM LIKE CREATE PROCEDURE Procedure1 ASIF SELECT LIKE ALL OF Table1, DUH UHH GO
:laugh:
Tech, life, family, faith: Give me a visit. I'm currently blogging about: Messianic Instrumentals (with audio) The apostle Paul, modernly speaking: Epistles of Paul Judah Himango
-
Josh Smith wrote:
Valley Girl SQL
Sweet :) UMM LIKE CREATE PROCEDURE Procedure1 ASIF SELECT LIKE ALL OF Table1, DUH UHH GO
You are like so totally a like hard core developer, or something. :cool: :josh: My WPF Blog[^]
-
Josh Smith wrote:
Valley Girl SQL
Sweet :) UMM LIKE CREATE PROCEDURE Procedure1 ASIF SELECT LIKE ALL OF Table1, DUH UHH GO
-
Josh Smith wrote:
Valley Girl SQL
Sweet :) UMM LIKE CREATE PROCEDURE Procedure1 ASIF SELECT LIKE ALL OF Table1, DUH UHH GO
:laugh: This gets the best post of the day award hands down! I can just see the Valley Girl SQL compiler error messages now:
line 1: "CREATE PROCEDURE"
compile error, expected token UMM, LIKE, or UHHSincerely, Alexander Wiseman
-
:laugh: This gets the best post of the day award hands down! I can just see the Valley Girl SQL compiler error messages now:
line 1: "CREATE PROCEDURE"
compile error, expected token UMM, LIKE, or UHHSincerely, Alexander Wiseman
Alexander Wiseman wrote:
compile error, expected token UMM, LIKE, or UHH
:laugh: Hilarious! Josh, I think you should patent the name.
-
:laugh: This gets the best post of the day award hands down! I can just see the Valley Girl SQL compiler error messages now:
line 1: "CREATE PROCEDURE"
compile error, expected token UMM, LIKE, or UHHSincerely, Alexander Wiseman
I think your post should share the award. :laugh: Cheers, Vikram.
"I am not Jesus and will never be. The fact is I was a piece of cr*p till I found Him." - Paul Selormey.
-
:laugh: This gets the best post of the day award hands down! I can just see the Valley Girl SQL compiler error messages now:
line 1: "CREATE PROCEDURE"
compile error, expected token UMM, LIKE, or UHHSincerely, Alexander Wiseman
line 1: "CREATE PROCEDURE" Ya know, there was this like compile error, and I kinda expected a token umm, like, UMM, LIKE, or UHH I've seen better runs in my shorts! - Patches O'Houlihan
-
Josh Smith wrote:
Valley Girl SQL
Sweet :) UMM LIKE CREATE PROCEDURE Procedure1 ASIF SELECT LIKE ALL OF Table1, DUH UHH GO
How about ... Umm SELECT LIKE STUFF FROM YOU KNOW LIKE DUH WHERE THINGS ARE LIKE WHATEVER ORDER BY DRIVETHROUGH, FRIESWITHTHAT = YES
-
I'm still relatively new to SQL and I was wondering whether there was an easier way to do things. I need to limit a query based on if a field is like one of three values. I can use "WHERE field in ('list one', 'list two', 'list three')", and I can to "WHERE field like 'list one' or field like 'list two' or field like 'list three'". Is there a way, however, to combine 'in' and 'like' to do something like "WHERE field in like ('list one', 'list two', 'list three') ?