Solved

Update statement with Select and Joined tables? [Firebird]

Posted on 2009-04-12
3
3,090 Views
Last Modified: 2013-12-09
Hello all,

Need help in getting a query to work. In order to get the 'value/result' I want I need a result which is based on two tables. I have tried several different alternatives, but failed to get it working..

Basically what it's doing is counting the value of a player's price (sports sim) which is based on the players offensive(Off) and defensive(Def) as well as the team's reputation(T.Rep).

As mentioned in the title I'm working with Firebird databases.

I'm a beginner, so bare with me please :)
update Players set P.Value = P.Off+P.Def+T.Rep (select P.*, T.* from Team T join Players P on T.Club = P.Club)

Open in new window

0
Comment
Question by:MerlaP83
  • 2
3 Comments
 
LVL 41

Expert Comment

by:pcelba
ID: 24125576
The change should bo following:
UPDATE Players SET Value = P.Off+P.Def+T.Rep

  FROM Players P

 INNER JOIN Team T on T.Club = P.Club

Open in new window

0
 

Author Comment

by:MerlaP83
ID: 24125594
Thanks for your reply.

I do get the error msg "SQL Error:  Dynamic SQL Error SQL error code = -104 Token unknown - line 1, column 48 FROM. Error Code: -104." Seems a bit weird.
0
 
LVL 41

Accepted Solution

by:
pcelba earned 125 total points
ID: 24125637
Sorry, Firebird does not support this syntax which is obvious for SQL Server, so, please try this:
UPDATE Players P 

   SET P.Value = P.Off+P.Def + (SELECT T.Rep FROM Team T WHERE T.Club = P.Club)

Open in new window

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Read about achieving the basic levels of HRIS security in the workplace.
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now