Re: help with sql statement

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

 



On 12 July 2010 18:34, Tommy Pham <tommyhp2@xxxxxxxxx> wrote:
> SELECT srs.Name FROM SMS_R_System srs WHERE srs.SystemOUName IN
> ("example.com/COMPUTERS/MAIN CAMPUS/ABC", "example.com/COMPUTERS/MAIN
> CAMPUS/XYZ")
>

As this is a single table query, there is no need for the table alias.

SELECT Name FROM SMS_R_System WHERE LEFT(SystemOUName, 34) =
'example.com/COMPUTERS/MAIN CAMPUS/' AND RIGHT(SystemOUName, 3) IN
('ABC', 'XYZ')

But this will probably take a measurable amount of time longer to
execute - 2 comparisons and 2 string processes. Maybe not for a single
run, but after several hundred.

-- 
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