Jump to content


Photo

Double pipe ( || ) in MySQL?


  • Please log in to reply
5 replies to this topic

#1 benjam

benjam
  • Members
  • PipPipPip
  • Advanced Member
  • 43 posts
  • LocationSalt Lake City, UT

Posted 03 October 2006 - 06:49 PM

I came across a query with a double pipe ( || ) in it and was wondering if the double pipe means anything in MySQL or if the designer meant ( OR ) and mistook it for PHP?
Windows 7
MySQL: 5.1.36-community
PHP: 5.3.2 VC9
Apache 2.2 (apachelounge VC9)

#2 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 03 October 2006 - 06:58 PM

http://dev.mysql.com...-operators.html
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/

#3 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 03 October 2006 - 06:59 PM

check out the logical operators page of the mysql manual. 'OR' and '||' are both accepted currently as logical or operators.

*doh - effigy's too quick ;)
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#4 benjam

benjam
  • Members
  • PipPipPip
  • Advanced Member
  • 43 posts
  • LocationSalt Lake City, UT

Posted 03 October 2006 - 07:35 PM

I thought it might be, but when I did a search for || it returned nothing.

Thanks.
Windows 7
MySQL: 5.1.36-community
PHP: 5.3.2 VC9
Apache 2.2 (apachelounge VC9)

#5 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 03 October 2006 - 08:53 PM

Remember that they have the same precedence (unlike in Perl).
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#6 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 04 October 2006 - 01:09 AM

Remember that they have the same precedence (unlike in Perl).

...or PHP ;)
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users