[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Update statement with Select and Joined tables? [Firebird]

Posted on 2009-04-12
3
Medium Priority
?
3,906 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 43

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 43

Accepted Solution

by:
pcelba earned 500 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

873 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