473,396 Members | 2,154 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,396 software developers and data experts.

using a join and field concatenation

Hi,

I am trying to use a join to update a table concatenating some fields together.

update TABLEA set STATUS = (b.TRANSACTION_ID||'Last TRANS was '||b.change_reason_code ||' - ' ||b.master_transaction_status)
where nat_supp_point_text in (select a.nat_supp_point_text from TABLEA a, TABLEB b
where a.nat_supp_point_text = b.nat_supp_point_text
and transaction_id in (select max(transaction_id) from TABLEB x, TABLEA y
where x.nat_supp_point_text = y.nat_supp_point_text and x.nat_supp_point_text = b.nat_supp_point_text))


I have two tables TABLEA AND TABLEB. I want to join both tables on a particular field and then I want to extract the latest record out of TABLEB and update TABLEA using a concatenation of certain TABLEB fields.

I get the statement to work correctly if I just do a simple SET = 'BLAH', but it fails when I try and concatenate fields from tableb with .... invalid indentifier

Any help would be much appreciated.


Actually I've had another go which seems to work -

update TABLEA A set STATUS = (select TRANSACTION_ID||'Last TRANS was '||change_reason_code ||' - ' ||master_transaction_status from TABLEB b
where a.nat_supp_point_text = b.nat_supp_point_text
and transaction_id in (select max(transaction_id) from TABLEB x, TABLEA y
where x.nat_supp_point_text = y.nat_supp_point_text and x.nat_supp_point_text = b.nat_supp_point_text))
Aug 18 '08 #1
0 1810

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

Similar topics

5
by: Carlos Ribeiro | last post by:
Hello all, I'm posting this to the list with the intention to form a group of people interested in this type of solution. I'm not going to spam the list with it, unless for occasional and...
3
by: sks | last post by:
I have a Product table, a Categories table and a join table that contains product to category mappings (each product can be in many categories) CREATE TABLE categories ( id bigint(20) unsigned...
2
by: Preston Landers | last post by:
Hello all. I am trying to write a query that "just" switches some data around so it is shown in a slightly different format. I am already able to do what I want in Oracle 8i, but I am having...
1
by: tekanet | last post by:
Hello folks, first of all I really don't know how you gurus call this way of writing joins: SELECT A.FIELD, B.FIELD FROM TABLE_A A, TABLE_B B
1
by: Steve | last post by:
I have been trying to find documentation on the behavior Can anyone tell me why the first example works and the second doesn't and where I can read about it in the language reference? Steve ...
52
by: MP | last post by:
Hi trying to begin to learn database using vb6, ado/adox, mdb format, sql (not using access...just mdb format via ado) i need to group the values of multiple fields - get their possible...
8
by: jason.teen | last post by:
Hi, Is it possible to join on an alias for a field value on-the-fly. Something like the nz() function, but not only for Null values. I want it to be for anything I stipulate as equivalent. ...
2
by: markios | last post by:
Hi, Ive got the code working to an extent when comparing the searchterm with an column name, but there is still 2 problems Im having. Initially the LIKE isnt working, Infact if I even enter...
27
by: Paulo da Silva | last post by:
Hi! I was told in this NG that string is obsolet. I should use str methods. So, how do I join a list of strings delimited by a given char, let's say ','? Old way:
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: 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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.