MySQL can use alias. if you "SELECT * FROM table as alias" then
whenever you reference the table later in the query, you have to use
alias.field instead of table.field. It also will return the results as
alias instead of table. Perhaps this is not compatible with all
database systems, I don't know. Though I did a quick google search and
found references to it in SQL Server and Access.
Dave
On Jan 24, 5:36 am, villas <[EMAIL PROTECTED]> wrote:
> @RichardatHome. That's what I figured. But maybe other DBs accept
> the 'alias' in the middle?
>
> @davidgregan. Which DB accepts this format? MySQL?
>
> DELETE {$alias} FROM table
>
> FirebirdSQL definitely doesn't like it :-)
>
> On Jan 24, 10:46 am, RichardAtHome <[EMAIL PROTECTED]> wrote:
>
> > I don't know firebirdSQL, but every other version of SQL (and this is
> > how the SQL92 spec. has it) I've ever used uses the syntax described
> > by villas:
>
> > DELETE FROM table WHERE conditions.
>
> > On Jan 24, 12:31 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > wrote:
>
> > > this is not correct SQL, it should be:
> > > DELETE "CURRENCY" FROM "CURRENCIES" AS "CURRENCY" WHERE
> > > "CURRENCY"."ID"
>
> > > so I'm guessing the line in dbo_source.php should be:
>
> > > return "DELETE {$alias} FROM {$table} {$this->alias} AS {$alias}
> > > {$joins}
> > > {$conditions}";
>
> > > Does this fix the problem as well? If so, you should probably change
> > > it to that, as a $conditions array will likely cause it to bomb again
> > > without AS {$alias}, since CakePHP will try to use the alias
> > > "CURRENCY" on any conditions instead of using the actual table name
> > > "CURRENCIES".
>
> > > On Jan 23, 4:21 pm, villas <[EMAIL PROTECTED]> wrote:
>
> > > > Cake 1.2 beta WindowsXP FirebirdSQL Code baked
>
> > > > I notice on deleting a record I get a SQL error
> > > > e.g.
> > > > DELETE "CURRENCY" FROM "CURRENCIES" "CURRENCY" WHERE
> > > > "CURRENCY"."ID" ...
>
> > > > Is this SQL correct -- why does the second word exist? ("CURRENCY"),
> > > > shouldn't it just be Delete From CURRENCIES....
>
> > > > I notice that everything seems to be OK if I edit dbo_source.php and
> > > > comment out the first {alias} in this line:
>
> > > > return "DELETE {$alias} FROM {$table} {$this->alias}{$alias} {$joins}
> > > > {$conditions}";
>
> > > > ...maybe it's just a FirebirdSQL thing?
>
> > > > If it's a bug I could report it, but I would appreciate advice
> > > > because I am often wrong about these things :-)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---