Loading

Updating multiple tables(3) simultaneously..

2 posts / 0 new
Last post
Offline
Joined: 10/29/2009
Updating multiple tables(3) simultaneously..

hello everyone..i have 3 tables t1,t2,t3..if i update t1,t2 and t3 must also be updated..how could i do this? i have just been tried
[CODE]UPDATE t1,t2,t3 SET t1.f1='sample',t2.f1='sample',t3.f1='sample' WHERE t1.f1='test' and t2.f1='test' and t1.f1='test'
[/CODE]

using this,update fails if t2 and t3 could not find 'test' in their fields,if i use OR all records will be..

i have also tried JOINS
[CODE]
Update tbl_maincat AS m LEFT JOIN tbl_maincat AS m2 ON m.cTitle = m2.cTitle,
tbl_main AS c LEFT JOIN tbl_main AS c2 ON c.MainCat = c2.Maincat,
tbl_subcat AS s LEFT JOIN tbl_subcat AS s2 ON s.csCat = s2.csCat
SET
m.cTitle = 'Hardware25',
m.cDesc = 'H2desc',
c.MainCat = 'Hardware25',
s.csCat = 'Hardware25'
WHERE
m.MainCatID=29 and
c.Maincat='Hardware23' and
s.csCat='Hardware23';[/CODE]
same...because of the AND operator...

if multiple query solved this..please let me know the proper construction in VB.net..

please everyone..its bugging me for almost a month..
im a newbie vb.net and mysql programmer..
thanks..

Offline
Joined: 10/29/2009
any reply will be much

any reply will be much appreciated..

Pages

Add new comment

Filtered HTML

  • You may insert videos with [video:URL]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.