Re: SQL ?

From: Date: Mon, 12 Aug 2002 15:19:49 +0000
Subject: Re: SQL ?
Groups: php.general 
Request: Send a blank email to php-general+get-112148@lists.php.net to get a copy of this message
My question as to what the AS statement did was just that, a question. It works perfectly, but I was curious if I was not completely understanding of what it did or if I could make better use of it. As for my reply i feel it was completely justified in that my post was on topic. I understand that Dan is on here alot just trying to be helpful, but in this case he had no intention of being helpful when he posted his reply. The fact is the message was on topic and if he had no useful information he should not have posted at all. It was never my intention to irritate anyone, just defend my post as it was a justified. If we have nothing nice or helpful to post to one another, then we should post nothing at all.
From: "DL Neil" <PHPml@DandE.HomeChoice.co.uk> To: "Tyler Durdin" <linuxgeek23@hotmail.com>,<php-general@lists.php.net> CC: <danielc@analysisandsolutions.com> Subject: Re: [PHP] SQL ? Date: Mon, 12 Aug 2002 15:49:45 +0100 Now then, let's all play nicely together! Dan: relevance It is a PHP question because whereas the SQL query SELECT fred FROM tbl produces an array element back in PHP such as $row[ "fred" ], this convention/mapping comes well unstuck if you submit something like SELECT IF ( answer = 'a', TRUE, FALSE )... or even SELECT fred+barney... Accordingly the need to create an alias column name (Answer-A) and thereafter in PHP to access the returned data with something like $row[ "Answer-A" ]. Tyler: appreciation and politeness I thought this looked familiar, and it is part of something I sent to you 36 hours ago to perform cross-totalling on a survey or exam results type database. Since then there has been no comment from you, except to others. If the suggestion doesn't work, please have the courtesy to come back to me, at least by cc:, for correction or amplification. NB If you had tested it at the MySQL (?) command line or using a management tool (recommended testing procedure before implementing in PHP), then you would have observed the result. Dan is often here, being helpful. Did you really mean to irritate two people by thoughtlessness if not deed, during the course of a single conversation? =dn Why not just let such a simple question go then? Especially since your reply is also off topic? Also, the question I asked was part of a reply from a previous topic. Thanks to all who answered my "simple" question. It is greatly appreciated.
On Mon, Aug 12, 2002 at 02:15:23PM +0000, Tyler Durdin wrote:
SELECT *, IF (answer = 'a', TRUE, FALSE) AS Answer-A What does the As Answer-A mean and what does it do?
Why not examine the manual for the answer to such a basic question, especially one that is off topic for the list you posted to? Assuming you're using MySQL read
http://www.mysql.com/doc/en/SELECT.html
and you'll quickly come across the meaning of AS.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
_________________________________________________________________ Join the world’s largest e-mail service with MSN Hotmail. http://www.hotmail.com

« previous php.general (#112148) next »