SonicBoomAu Posted April 22, 2005 Posted April 22, 2005 Hi All, Is it possible to have multiply WHERE statements in a SQL Statement? This is the code I am currently working with: Dim str1 As String = "SwitchLoc" Dim str2 As String = "BladeNo" Dim str3 As String = "PortNo" Dim strNewSQLStatement As String strNewSQLStatement = "SELECT " & strP2Custom & " From PermanentAssets WHERE " & _ str1 & " = '" & strSwitchLocValue & "' & " & _ str2 & " = '" & strBladeLocValue & "' & " & _ str3 & " = '" & strPortNoValue & "'" strSwitchLocValue, strBladeLocValue, strPortNoValue are captured in another part of the program and are either set to * or a specifed value. Quote Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -- Rick Cook, The Wizardry Compiled
Mister E Posted April 22, 2005 Posted April 22, 2005 Yes, SQL has the standard boolean operators such as AND and OR. SELECT P.Name FROM People P WHERE (P.Age > 50 AND P.Rating < 80) OR P.Name='George' Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.