Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Jefferson Aguilar
  Where is Jefferson Aguilar?
 Cabanatuan
 Philippines
 Jefferson Aguilar
 To: Stewart Chew
  Where is Stewart Chew?
 
 Malaysia
 Stewart Chew
 Tags
Subject: RE: Problem Update MySql Database
Thread ID: 143259 Message ID: 143276 # Views: 2 # Ratings: 0
Version: Visual FoxPro 9 Category: Databases, Tables and SQL Server
Date: Monday, August 27, 2007 12:46:09 PM         
   


hi,

try this one:

UPDATE s_partcode SET unit_cost = mUnitCost
WHERE (SELECT upd FROM cSticker WHERE cSticker.part_code = s_partcode.partcode) = 1

i havent' tested it myself.
it is just that i haven't used FROM and
INNER JOINs in any of my UPDATE SQL commands.


regards,
jeff



> Dear Expert,
>
> I've problem update records, can anyone here help me? I need to update the records using INNER JOIN command, but mySql can't accept INNER JOIN function, please help.....
>
>
> SELECT cSticker
> DO WHILE .T.
> LOCATE FOR cSticker.Unit_cost > 0 AND cSticker.upd = 1
> IF FOUND()
> 	IF MESSAGEBOX('Update',292,'Are you sure?') = 6
> 	
> 		UPDATE cSticker SET unit_cost = mUnitCost WHERE upd = 1
> 
> 		TEXT TO lcSql NOSHOW PRETEXT 15 TEXTMERGE
> 			UPDATE s_partcode SET unit_cost = cSticker.unit_code
> 				FROM s_partcode INNER JOIN cSticker ON s_partcode.part_code = cSticker.part_code
> 				WHERE cSticker.upd = 1
> 		ENDTEXT
> 
> 		IF SQLPREPARE(oConn, lcSql) < 0
> 			AERROR(laError)
> 			MESSAGEBOX(laError[1,2])
> 		ENDIF
> 
> 		IF SQLEXEC(oConn) < 0
> 		   AERROR(laError)
> 		   MessageBox(laError[1,2])
> 		   EXIT
> 		ENDIF
> 	ENDIF
> 	EXIT
> ELSE
> 	WAIT WINDOWS [Invalid choice]
> 	EXIT
> ENDIF
> ENDDO
> 

>
>
>
> Regards,
>
> Stewart Chew

ENTIRE THREAD

Problem Update MySql Database Posted by Stewart Chew @ 8/27/2007 7:40:51 AM
RE: Problem Update MySql Database Posted by Jefferson Aguilar @ 8/27/2007 12:46:09 PM