Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Combining in and like

Combining in and like

Scheduled Pinned Locked Moved C#
databasequestion
13 Posts 11 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Drew McGhie

    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') ?

    J Offline
    J Offline
    Josh Smith
    wrote on last edited by
    #2

    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[^]

    D 1 Reply Last reply
    0
    • D Drew McGhie

      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') ?

      T Offline
      T Offline
      ToddHileHoffer
      wrote on last edited by
      #3

      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

      1 Reply Last reply
      0
      • J Josh Smith

        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[^]

        D Offline
        D Offline
        Dustin Metzgar
        wrote on last edited by
        #4

        Josh Smith wrote:

        Valley Girl SQL

        Sweet :) UMM LIKE CREATE PROCEDURE Procedure1 ASIF SELECT LIKE ALL OF Table1, DUH UHH GO


        Logifusion[^]

        J J L A D 5 Replies Last reply
        0
        • D Dustin Metzgar

          Josh Smith wrote:

          Valley Girl SQL

          Sweet :) UMM LIKE CREATE PROCEDURE Procedure1 ASIF SELECT LIKE ALL OF Table1, DUH UHH GO


          Logifusion[^]

          J Offline
          J Offline
          Judah Gabriel Himango
          wrote on last edited by
          #5

          :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

          1 Reply Last reply
          0
          • D Dustin Metzgar

            Josh Smith wrote:

            Valley Girl SQL

            Sweet :) UMM LIKE CREATE PROCEDURE Procedure1 ASIF SELECT LIKE ALL OF Table1, DUH UHH GO


            Logifusion[^]

            J Offline
            J Offline
            Josh Smith
            wrote on last edited by
            #6

            You are like so totally a like hard core developer, or something. :cool: :josh: My WPF Blog[^]

            1 Reply Last reply
            0
            • D Dustin Metzgar

              Josh Smith wrote:

              Valley Girl SQL

              Sweet :) UMM LIKE CREATE PROCEDURE Procedure1 ASIF SELECT LIKE ALL OF Table1, DUH UHH GO


              Logifusion[^]

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #7

              awesome :laugh:

              1 Reply Last reply
              0
              • D Dustin Metzgar

                Josh Smith wrote:

                Valley Girl SQL

                Sweet :) UMM LIKE CREATE PROCEDURE Procedure1 ASIF SELECT LIKE ALL OF Table1, DUH UHH GO


                Logifusion[^]

                A Offline
                A Offline
                Alexander Wiseman
                wrote on last edited by
                #8

                :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 UHH

                Sincerely, Alexander Wiseman

                D V B 3 Replies Last reply
                0
                • A 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 UHH

                  Sincerely, Alexander Wiseman

                  D Offline
                  D Offline
                  Dustin Metzgar
                  wrote on last edited by
                  #9

                  Alexander Wiseman wrote:

                  compile error, expected token UMM, LIKE, or UHH

                  :laugh: Hilarious! Josh, I think you should patent the name.


                  Logifusion[^]

                  1 Reply Last reply
                  0
                  • A 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 UHH

                    Sincerely, Alexander Wiseman

                    V Offline
                    V Offline
                    Vikram A Punathambekar
                    wrote on last edited by
                    #10

                    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.

                    1 Reply Last reply
                    0
                    • A 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 UHH

                      Sincerely, Alexander Wiseman

                      B Offline
                      B Offline
                      Blake Miller
                      wrote on last edited by
                      #11

                      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

                      1 Reply Last reply
                      0
                      • D Dustin Metzgar

                        Josh Smith wrote:

                        Valley Girl SQL

                        Sweet :) UMM LIKE CREATE PROCEDURE Procedure1 ASIF SELECT LIKE ALL OF Table1, DUH UHH GO


                        Logifusion[^]

                        D Offline
                        D Offline
                        DontSailBackwards
                        wrote on last edited by
                        #12

                        How about ... Umm SELECT LIKE STUFF FROM YOU KNOW LIKE DUH WHERE THINGS ARE LIKE WHATEVER ORDER BY DRIVETHROUGH, FRIESWITHTHAT = YES

                        1 Reply Last reply
                        0
                        • D Drew McGhie

                          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') ?

                          N Offline
                          N Offline
                          NRavep
                          wrote on last edited by
                          #13

                          Select Field1,Field2,Field3 From TableName Where Field1 In(Select Field4 From Table2 Where Field4 Like '%Something%')

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups