JOIN not work

User avatar
sal21
PlatinumLounger
Posts: 4353
Joined: 26 Apr 2010, 17:36

JOIN not work

Post by sal21 »

Possible cause this sql dont update DT:

Code: Select all

UPDATE ANA_AG INNER JOIN L0928_SI ON ANA_AG.COD_AG = L0928_SI.SPORT SET L0928_SI.DT = ANA_AG.COD_DT WHERE L0928_SI.SPORT='0100'
SPORT is text
COD_AG is text

and sure have in ana_ag correspondence COD_AG 0100>COD_DT 4587

User avatar
HansV
Administrator
Posts: 78438
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: JOIN not work

Post by HansV »

Do you have an index on the join fields?
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4353
Joined: 26 Apr 2010, 17:36

Re: JOIN not work

Post by sal21 »

HansV wrote:Do you have an index on the join fields?
Yes... on SPORT and COD_AG

User avatar
HansV
Administrator
Posts: 78438
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: JOIN not work

Post by HansV »

I'm afraid I'd have to see the database...
Best wishes,
Hans

Rui
StarLounger
Posts: 57
Joined: 02 Sep 2011, 10:44

Re: JOIN not work

Post by Rui »

I would suggest a simple similar select query, just to check if there are any records that should be updated:

Code: Select all

SELECT * FROM ANA_AG INNER JOIN L0928_SI ON ANA_AG.COD_AG = L0928_SI.SPORT  WHERE L0928_SI.SPORT='0100'