& and && and weird results

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I hope somebody can make sense of this.
First, I don't understand what the difference is supposed to be between
& and && - is there a difference for php and/or mysql?
Second, I am trying to select all occurrences in a table.column where
the first letter of the name is I, J, or K but not I or J or K; I want
the all. Now, entering the following is no problem for any one letter:
SELECT * FROM book
        WHERE id IN (SELECT bookID
        FROM book_author WHERE authID IN (SELECT author.id
        FROM author
        WHERE LEFT(last_name, 1 ) = '$Auth' ));

But the following does not work:

SELECT * FROM book
        WHERE id IN (SELECT bookID
        FROM book_author WHERE authID IN (SELECT author.id
        FROM author WHERE LEFT(last_name, 1 ) = '$Auth' &&
LEFT(last_name, 1 ) = '$Auth1' && LEFT(last_name, 1 ) = '$Auth2'));

Yet this gives off the wall results where the last names are nowhere
near what they should be.
Anyone have a rational explanation?

-- 
unheralded genius: "A clean desk is the sign of a dull mind. "
-------------------------------------------------------------
Phil Jourdan --- pj@xxxxxxxxxxxxx
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux