TDolphin got error MySql/1052 Column 'deleted' is ambiguous

TDolphin got error MySql/1052 Column 'deleted' is ambiguous

Postby dutch » Mon Sep 14, 2015 4:26 am

Dear All,

I have some problem with duplicated field (deleted, it are in all table to identify deleted status). I open table with relation, when I delete a record but it show error as below.
MYSQL/1052 Column 'deleted' in field list is ambiguous

I open with this command
Code: Select all  Expand view
Function OpenDb(cTable, cQuery, cOrderBy, cTable1, cRelation1, cTable2, cRelation2, cTable3, cRelation3 )
local cFileName, cFile, cFullName
local cSql, oErr, oDb
.....
        cSql := "SELECT * FROM "+lower(cTable)+ ;
                        iif(!empty(cTable1)," LEFT JOIN "+lower(cTable1)+" ON "+lower(cRelation1),"")+;
                        iif(!empty(cTable2)," LEFT JOIN "+lower(cTable2)+" ON "+lower(cRelation2),"")+;
                        iif(!empty(cTable3)," LEFT JOIN "+lower(cTable3)+" ON "+lower(cRelation3),"")+;
                        iif(!empty(cQuery)," WHERE "+cQuery+" AND deleted<>'Y'","")+;   //
                        iif(!empty(cOrderBy)," ORDER BY "+cOrderBy,"")
                       
    oDb := MEMVAR->oServer:Query(cSql)
return oDb

I use TDolphin to access MySql Db.
​When I replace 'Y' in deleted field as
Code: Select all  Expand view
oDb:deleted := 'Y'

it show an error, how do I fix it? How to specific table with field in relation condition?

Thanks in advance for help and any idea.
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: TDolphin got error MySql/1052 Column 'deleted' is ambiguous

Postby MGA » Mon Sep 14, 2015 11:10 am

Provavelmente algum campo das tabelas relacionadas está com o mesmo nome.

Vamos supor que o problema seja o campo "descrição", você teria que fazer algo assim:

SELECT c.*, t.descricao as descricaotabtest FROM client as c LEFT JOIN test as t...
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1252
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: TDolphin got error MySql/1052 Column 'deleted' is ambiguous

Postby dutch » Thu Sep 17, 2015 7:55 am

I use through TDolphin as below;

Code: Select all  Expand view
oDb:deleted := 'Y'
oDb:Save()
 

How can I replace with SQL command?

Thanks.
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 59 guests