Hi,
> Hi,
> I'm trying to use an if then alike statement in MySQL, myabe
> anyone can tell me the correct syntax if got a variable named
> naam. when the content of this variables is empty the following
> SQL statement should be executed:
> select * from beheerder;
> when naam is not empty:
> select * from beheerder wherer naam like '%naam%'
> Can this be done with SQL language?
that looks like something that should be done in your front-end
level (Perl, PHP, whatever).
but actually, if you run "select * from beheerder wherer naam like '%naam%'"
and naam (what you probably pass from a script) is empty, the query will
produce the same results as "select * from beheerder", since "%%" will
match everything.
Rgds,
Tfr
--==< [EMAIL PROTECTED] >==< MySQL development team >==< Tallinn / Estonia >==--
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php