473,385 Members | 1,341 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,385 software developers and data experts.

Arrrgh! UPDATE tbl1 from tbl2 - what am I doing wrong?

Need to update col dated in tbl po_history from col date_expense in tbl
po_expenses. Have tried, back ticks, single quotes, no quotes, etc.
left join and no join. No joy. Results is consistent Error Code 1064.
Searched MySQL.com it appears that my syntax and usage is correct, but
still get the parse error. Representative sample is below. Running a
select provides desired rows, attempting update throws error. MySQL is
v:3.23.33.

select po_history.rid, fk2_po_expense, dated, date_expense, `b`.rid from
`po_history`
left join `po_expenses` as b
on (`po_history`.fk2_po_expense = `b`.rid)
where fk2_po_expense >=1000

---- or ------

select po_history.rid ,fk2_po_expense ,dated, date_expense ,po_expenses.rid
from `po_history`, `po_expenses`
where fk2_po_expense >=1000 and (`po_history`.fk2_po_expense =
`po_expenses`.rid)

example results from either above: ==== (as expected) ========
rid fk2_po_expense dated date_expense po_expenses.rid
1022 1012 0000-00-00 2004-04-05 1012
1023 1113 0000-00-00 2004-04-06 1113
1052 1214 0000-00-00 2004-06-18 1214
1090 1310 0000-00-00 2004-04-09 1310
1141 1411 0000-00-00 2004-06-30 1411
1319 1508 0000-00-00 2004-04-20 1508
1320 1600 0000-00-00 2004-04-21 1600
1321 1720 0000-00-00 2004-04-21 1720
1322 1721 0000-00-00 2004-04-21 1721
1323 1723 0000-00-00 2004-04-21 1723

update `po_history`, `po_expenses`
set dated = date_expense
where fk2_po_expense >=1000 and (`po_history`.fk2_po_expense =
`po_expenses`.rid)
Error Code : 1064
You have an error in your SQL syntax near ' `po_expenses`
set dated = date_expense
where fk2_po_expense >=1000 and (`po_h' at line 1

from MySQL the 1064 translates to:
Error: 1064 SQLSTATE: 42000 (ER_PARSE_ERROR) Message: %s near '%s' at
line %d

I'm lost ...

TIA

Please respond to the group
or remove _

Jul 20 '05 #1
0 1321

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Larry Jaques | last post by:
I'm filling out forms on one page, then trying to send an email and print out the vars on the next page. Q1: Whenever I insert the mail script, it gives me a parse error. Please point out my...
23
by: JC | last post by:
I am very new to programming and learning on my own. Why do I keep getting duplicate values using this code? I want to shuffle a deck of 52 cards. The logic seems right to me. Randomize For...
20
by: Terry | last post by:
I'm trying to have two divs side-by-side, each taking up 50% of the body. Sounds simple enough, right? http://novodom.net/div.html The code validates as XHTML 1.1 Strict. Looks fine in Firefox,...
383
by: John Bailo | last post by:
The war of the OSes was won a long time ago. Unix has always been, and will continue to be, the Server OS in the form of Linux. Microsoft struggled mightily to win that battle -- creating a...
3
by: dave | last post by:
ISBN 1-861000-88-X I'm confused about these references to the usage of recursion pertaining to example Ex6_08A: On page 236 in the last sentence of the 3rd paragraph "Since any set of...
2
by: Jonas Cord | last post by:
Hi, I'm trying to learn proxy classes in C++ so I've written the following code, trying to modify an example given in Deitel & Deitel's C++ book. I am trying to "hide" details of the original...
2
by: Leonardo | last post by:
I have the following html. Each <td> has a class. onmouseover i'm changing said class and I'm wondering if javascript can change the class onclick, so that it stays a different color, and changes...
2
by: Rob Mayo | last post by:
OK, maybe this is my opinion, maybe these are bugs. Given the folowing: I have a NotifyIcon on my Form, a Context menu associated with the NotifyIcon, and a MenuItem on the ContextMenu set as...
6
by: Tim Marshall | last post by:
Here's the situation. A form, frmSetUp, with a subform control called subExplain with a source object form frmSetUpSubDefineSides. The source object is a bound form, displaying a few records, no...
1
by: musosdev | last post by:
Hi guys I was using the Microsoft.Web.UI.WebControls extra namespace in my application to provide me with a TreeView control. I was using specifically ..GetNodeFromIndex(), SelectedNodeIndex and...
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: 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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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.