473,500 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can someone tell me why this query doesn't work?

3 New Member
UPDATE tblplayers a,
(
SELECT SUM(COALESCE(costCP, 0)) AS CPCOUNT, forumMemberID
FROM tblplayers c
LEFT OUTER JOIN tblplayerabilities a ON a.playerID = c.forumMemberID
LEFT OUTER JOIN tbldoctrineabilities b ON a.abilityID = b.abilityID
GROUP BY CP, forumMemberID
) b
SET a.CP = 15 - (b.CPCOUNT+a.CP)
WHERE a.forumMemberID = b.forumMemberID
AND (b.CPCOUNT+a.CP) < 15

--

I appears to hate the (b.CPCOUNT+a.CP) portion in the SET statement. If I use an integer there, it works fine. Maybe there's another way to do this?
Feb 28 '08 #1
2 1064
bfreshour
3 New Member
Hmm... I just got it to work by doing the following...
Expand|Select|Wrap|Line Numbers
  1. UPDATE tblplayers a,
  2. (
  3. SELECT SUM(COALESCE(costCP, 0)) AS CPCOUNT, forumMemberID
  4. FROM tblplayers c 
  5. LEFT OUTER JOIN tblplayerabilities a ON a.playerID = c.forumMemberID
  6. LEFT OUTER JOIN tbldoctrineabilities b ON a.abilityID = b.abilityID
  7. GROUP BY CP, forumMemberID
  8. ) b
  9. SET a.CP = a.CP + (15 - b.CPCOUNT)
  10. WHERE a.forumMemberID = b.forumMemberID
  11. AND (b.CPCOUNT+a.CP) < 15
Feb 28 '08 #2
ronverdonk
4,258 Recognized Expert Specialist
Good you found it. Next time, enclose your code within code tags. Read the Posting Guideline on that.

moderator
Feb 28 '08 #3

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

Similar topics

6
3620
by: What-a-Tool | last post by:
I'm going out out of my mind trying to get this to work with no luck. The error message I get is at the bottom. Can someone please tell me what I'm doing wrong here. I've tried this a million...
0
1480
by: Mike Chirico | last post by:
Hopefully this will help someone... Helpful Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Last Updated: Fri Apr 16 11:47:34 EDT 2004 The latest version of this...
3
1254
by: Randell D. | last post by:
Folks, I'm working on an ecommerce website that deals with credit card expiry dates. The table has two columns for year and month. I currently have a select that says: ...
2
8491
by: Mike Leahy | last post by:
Hello all, This question is related to updating tables - is there any way to calculate or update the values in a column in a table to the values in a field produced by a query result? An...
3
1404
by: chucher | last post by:
I´m developing a database in access about invoices that could use to different kinds of money (US Dollar and Pesos). I have a form where you can insert the invoices and de items of de invoice. I...
36
2988
by: Liam.M | last post by:
hey guys, I have one last problem to fix, and then my database is essentially done...I would therefore very much appreciate any assistance anyone would be able to provide me with. Currently I...
3
1498
by: sparks | last post by:
I have 2 fields that I have to make sure don't get screwed up. (could be one it doesn't matter) but what they want is no duplicates, warn the user changing existing numbers is a no no. (of course...
2
4841
by: blueyonder | last post by:
The statament below does exactly what I want it to do but I don't understand why? In my mind the subquery produces a result set which is a subset of the handset table which the initial part of...
3
3794
by: Kevin M | last post by:
I have one table and have created a form from that table. Also, I have created a delete query. I want to but a button on the form which will delete all records from the table; however, I cannot get...
12
2131
by: Lnwolf | last post by:
Hello, I am having an issue with my synchronized combo boxes and don't know how to fix it. I have created two boxes and have made the synchronization work (the user clicks on the first box and...
0
7018
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
7232
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...
1
6906
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7397
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...
1
4923
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4611
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3110
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1430
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
316
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.