New topic: SQL Help!
<http://forums.realsoftware.com/viewtopic.php?t=45985> Page 1 of 1 [ 3 posts ] Previous topic | Next topic Author Message JohnV Post subject: SQL Help!Posted: Mon Nov 19, 2012 5:49 pm Joined: Sun Jan 28, 2007 2:38 pm Posts: 141 Where the Last_Name OR Company_Name = "Smith" AND the state ="NJ" AND the SIC_Code="1234" I want all companies and people with the name Smith IN NJ with the SIC code 1234. Help! Top elChupete Post subject: Re: SQL Help!Posted: Mon Nov 19, 2012 6:15 pm Joined: Fri Jun 05, 2009 11:50 am Posts: 321 Location: Hamburg, Germany Assuming the complete data is stored in just one table: select * from table where (Last_Name = 'Smith' OR Company_Name = 'Smith') AND State = 'NJ' AND SIC_Code = '1234' should do what you want First condition Second condition Third Condition Note, that First conditions is put in brackets () to enable A OR B _________________ Best regards Stefan Mac OSX 10.8.1 on a MacBook Pro 2.66 GHz Intel Core i7/ RB Professional 2011 Release 3 Top DaveS Post subject: Re: SQL Help!Posted: Mon Nov 19, 2012 7:21 pm Joined: Sun Aug 05, 2007 10:46 am Posts: 4271 Location: San Diego, CA FYI... the need to use brackets to isolate AND OR in same condition is NOT unique to SQL... It applies to all languages... including Real Studio itself. Boolean Algebra 101 _________________ Dave Sisemore MacPro, OSX Lion 10.7.4 RB2012r1 Note : I am not interested in any solutions that involve custom Plug-ins of any kind Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 3 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
