Yeah, that query doesn't make any sense to me either.
If you told me what you're trying to do, I can probably put you on the
right path.
In general, an SQL query is going to go:
SELECT {stuff} FROM {table} WHERE {some conditions are met}
I've never seen an instance where I needed IF, THEN, ELSE or ELSEIF in a
query.
There's lots of good stuff in the manual, and a ton of SQL primers in
the archive.
http://dev.mysql.com/doc/mysql/en/select.html
Thanks,
Jeromie
>Please understand though my questions may seem VERY simple, I am
>actually trying to write code and learn MySQL at the same time. I
>apologize for the simplistic nature of the question.
>
>I have a Table it has the fields
>Project (INT)
>Projectname (VARCHAR)
>Salesname (VARCHAR)
>as well as many others
>
>My Query that does not work
>
>SELECT v_salesdetails.salesid,v_salesdetails.project,
>v_salesdetails.responsible,v_salesdetails.statusname,
>v_salesdetails.builder,v_salesdetails.status,
>v_salesdetails.buildername,
>IF project = '' THEN v_salesdetails.salesname
> ELSE v_salesdetails.projectname AS salesname
>END IF,
> v_salesdetails.employeename
>FROM v_salesdetails
>
>This just kicks back not working with an error 1064... Syntax problem.
>
>Please help me distinguish what I am doing wrong in my statement.
>
>Kevin
>
>
The php_mysql group is dedicated to learn more about the PHP/MySQL web database
possibilities through group learning.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php_mysql/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/