FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TDolphin got error MySql/1052 Column 'deleted' is ambiguous
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM

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

Posted: Mon Sep 14, 2015 04: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 (fw): Select all Collapse
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 (fw): Select all Collapse
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 2304 / 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)
Posts: 1286
Joined: Mon Feb 25, 2008 02:54 PM

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

Posted: 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
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM

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

Posted: Thu Sep 17, 2015 07:55 AM
I use through TDolphin as below;

Code (fw): Select all Collapse
oDb:deleted := 'Y'
oDb:Save()

How can I replace with SQL command?

Thanks.
Regards,

Dutch



FWH 2304 / 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)

Continue the discussion