473,382 Members | 1,252 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Updating 3 tables in one query without using stored proc

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
Expand|Select|Wrap|Line Numbers
  1. 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' 
  2.  
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
Expand|Select|Wrap|Line Numbers
  1. Update tbl_maincat AS m LEFT JOIN tbl_maincat AS m2 ON m.cTitle = m2.cTitle,
  2. tbl_main AS c LEFT JOIN tbl_main AS c2 ON c.MainCat = c2.Maincat,
  3. tbl_subcat AS s LEFT JOIN tbl_subcat AS s2 ON s.csCat = s2.csCat
  4. SET
  5. m.cTitle = 'Hardware25',
  6. m.cDesc = 'H2desc',
  7. c.MainCat = 'Hardware25',
  8. s.csCat = 'Hardware25'
  9. WHERE
  10. m.MainCatID=29 and
  11. c.Maincat='Hardware23' and
  12. s.csCat='Hardware23';
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..
Jul 1 '10 #1
1 1054
mafaisal
142 100+
What about Trigger..?
Jul 7 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: | last post by:
Hi I am using SQL server 7.0 and here is my code: Dim conn set conn = Server.CreateObject("ADODB.Connection") conn.open "websql" If conn.state=adStateOpen then Response.Write("ConnMade :...
0
by: Petre Agenbag | last post by:
Hi List Can anyone help me to do the following without the need of subselects: I have a table that contains rows where mostly, the only common field is the "name". The rest of the data...
0
by: Taras | last post by:
Hello! I have a problem. I'm using a dataset in VB.NET with multiple tables with relations between them. I would like dataset to update to all related tables with right identity, when certain...
9
by: Wolfgang Kreuzer | last post by:
Try hard to become familiar with T-SQL. Can anybodey tell me the best way to deal with set's provided by a stored procedure. Til yesterday I thougt trapping set in temp table using INSERT EXEC...
5
by: Hennie | last post by:
Hi Can anybody point me to good articles or sites on using stored proc's in a grid or details view in ASP2.0 Also how can I return the username of the current logged in user as a parameter...
1
by: Taras | last post by:
Hello! I have a problem. I'm using a dataset in VB.NET with multiple tables with relations between them. I would like dataset to update to all related tables with right identity, when certain...
10
by: Eric E | last post by:
Hi all, I am using an Access client linked to a PG 7.4 server via ODBC. I have a stored proc on the server that inserts rows into a table.particular table, accomplished via an INSERT within the...
4
by: uspensky | last post by:
I have a table (cars) with 3 fields: VIN, Class, sell_price 101, sports, 10000 102, sports, 11000 103, luxury, 9000 104, sports, 11000 105, sports, 11000 106, luxury, 5000 107, sports, 11000
8
by: jbonifacejr | last post by:
Hi. I'm sorry to bother all of you, but I have spent two days looking at code samples all over the internet, and I can not get a single one of them to work for me. I am simply trying to get a value...
0
MrMancunian
by: MrMancunian | last post by:
How to create a database connection without using wizards Introduction I've seen a lot of questions on the net about getting data from, and saving data to databases. Here's a little insight how...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.