Recent PostsRecent Posts Popular TopicsPopular Topics
 Home Search Members Calendar Who's On

 Logic Precedence Rate Topic Display Mode Topic Options
Author
 Message
 Posted Wednesday, February 12, 2014 2:20 AM
 Right there with Babe Group: General Forum Members Last Login: Thursday, September 18, 2014 4:13 AM Points: 747, Visits: 1,315
 very good question for the beginners to understand what OR , AND does.Thanks for sharing ..
Post #1540591
 Posted Wednesday, February 12, 2014 3:31 AM
 SSC Eights! Group: General Forum Members Last Login: Saturday, September 13, 2014 4:06 AM Points: 988, Visits: 804
 Always add brackets when mixing operators. Even if you know the rules, brackets make a calculation less prone to misunderstanding.
Post #1540604
 Posted Wednesday, February 12, 2014 3:45 AM
 SSC Eights! Group: General Forum Members Last Login: Tuesday, September 9, 2014 2:33 AM Points: 985, Visits: 2,563
 david.wright-948385 (2/12/2014)Always add brackets when mixing operators. Even if you know the rules, brackets make a calculation less prone to misunderstanding.+1
Post #1540607
 Posted Wednesday, February 12, 2014 4:11 AM
 Hall of Fame Group: General Forum Members Last Login: 2 days ago @ 11:15 AM Points: 3,964, Visits: 5,204
 david.wright-948385 (2/12/2014)Always add brackets when mixing operators. Even if you know the rules, brackets make a calculation less prone to misunderstanding.Parenthesis prevent uncertainty (and possible misunderstanding)Thanks for the easy one today, Steve ____________________________________________Space, the final frontier? not any more...All limits henceforth are self-imposed.“libera tute vulgaris ex”
Post #1540621
 Posted Wednesday, February 12, 2014 5:03 AM
 Hall of Fame Group: General Forum Members Last Login: Today @ 11:54 AM Points: 3,971, Visits: 3,411
 It was a simple question, but nonetheless a good one. How many times have we all been tripped up somewhere and spent hours on it, only to find that the problem was something so simple that we don't even want to admit it to ourselves? Always good to keep the basics in mind, no matter how far back they get.
Post #1540654
 Posted Wednesday, February 12, 2014 6:44 AM
 SSCommitted Group: General Forum Members Last Login: Friday, August 29, 2014 10:20 AM Points: 1,740, Visits: 6,366
 Didn't know whether OR or AND had priority, so guessed (correctly )It's not something I've ever really needed to know, doesn't everyone use brackets in cases like this, to make it clear what is meant?
Post #1540700
 Posted Wednesday, February 12, 2014 6:51 AM
 SSCrazy Group: General Forum Members Last Login: Thursday, September 18, 2014 8:39 AM Points: 2,935, Visits: 239
 WhooHoo I got it.
Post #1540703
 Posted Wednesday, February 12, 2014 7:29 AM
 Ten Centuries Group: General Forum Members Last Login: Friday, September 12, 2014 7:18 PM Points: 1,325, Visits: 1,693
 david.wright-948385 (2/12/2014)Always add brackets when mixing operators. Even if you know the rules, brackets make a calculation less prone to misunderstanding.Until you have several layers of brackets, at which point pairing them up can become as difficult as parsing the text. This can be alleviated by formatting, e.g:`WHERE ( (a = b) OR (b = c) ) AND ( (c = d) OR ( (d = e) AND (e = f) ) )`as opposed to `WHERE ((a = b) OR (b = c)) AND ((c = d) OR ((d = e) AND (e = f)))`The latter, of course, being the type of code outputted by Microsoft's query designers on a regular basis...
Post #1540725
 Posted Wednesday, February 12, 2014 7:46 AM
 SSCoach Group: General Forum Members Last Login: Yesterday @ 5:20 PM Points: 17,600, Visits: 15,462
 twin.devil (2/12/2014)very good question for the beginners to understand what OR , AND does.Thanks for sharing ..Yes - and even for the experienced to remind them of the order of operations. Jason AKA CirqueDeSQLeilI have given a name to my pain...MCM SQL ServerSQL RNNRPosting Performance Based Questions - Gail ShawPosting Data Etiquette - Jeff ModenHidden RBAR - Jeff ModenVLFs and the Tran Log - Kimberly Tripp
Post #1540733
 Posted Wednesday, February 12, 2014 7:55 AM
 SSC Eights! Group: General Forum Members Last Login: Saturday, September 13, 2014 4:06 AM Points: 988, Visits: 804
 sknox (2/12/2014)...This can be alleviated by formatting, e.g:`WHERE ( (a = b) OR (b = c) ) AND ...`as opposed to `WHERE ((a = b) OR (b = c)) AND ((c = d) OR ((d = e) AND (e = f)))`Exactly. IMHO, this goes for general query layout too.
Post #1540744

 Permissions