Reply to Re: [PHP] strange in MySQL Query.

Your name:

Reply:


Posted by Jochem Maas on 01/14/05 15:18

adwin wijaya wrote:
> Hi...
>
>

Adwin,

(btw: php-db@lists.php.net would be a better place for this question)

do you realise that GROUP is an SQL keyword (as in the GROUP BY clause)
and as such you will need to escape it using backticks (in the case of
MySQL).

Also I have a sneaking suspicion that TYPE might be a reserved word too
- you may want to put that in backticks too.

> I have an query for mysql that looks like:
>
> SELECT "group" as type FROM mytable WHERE id ="101010"
> UNION
> SELECT "individual" as type FROM myothertable WHERE id="101010"
>
> The strange result if only one result displayed from myothertable, so
> the "type" will become "indiv" instead of individual.

that sounds to me like the result is being grouped!

>
> But when I tried to switch the query become :
>
> SELECT "individual" as type FROM myothertable WHERE id="101010"
> UNION
> SELECT "group" as type FROM mytable WHERE id ="101010"
>
> it could displaye the result correctly. I dont know why .. is this mysql
> bug ?
>
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация