473,624 Members | 2,584 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(co stCP, 0)) AS CPCOUNT, forumMemberID
FROM tblplayers c
LEFT OUTER JOIN tblplayerabilit ies a ON a.playerID = c.forumMemberID
LEFT OUTER JOIN tbldoctrineabil ities 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 1071
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
3625
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 different ways and can't get it to work. I can get it to work with VBScript, but I need to do this project in JavaScript. HELP- PLEASE!? <%@Language=JavaScript%> <%Response.buffer=true%> <%
0
1487
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 document can be found at: http://prdownloads.sourceforge.net/souptonuts/README_mysql.txt?download Format is better on the above link. I'm looking for suggestions and
3
1268
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: (ExpiryDateYear<=$currentYear AND ExpiryDateMonth<=$currentMonth) Meaning where the card Expiry Date Year column is this year, or older than this year *AND* where the Expiry Date Month column is this month or
2
8522
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 example of what I'm trying to do is below: update (tbl_ind_mananas LEFT JOIN (select count(*) as count, (dubicacion || zona || manzana) as cod_manzana from tbl_censo_poblacion_1993 group by dubicacion, zona, manzana) tbl1 on relacion = cod_manzana) as...
3
1415
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 can insert all everything right Also I made a detailInvoice query that show every invoice item with the invoice information (invoiceNumber, client, kindOfMoney, idItem, product, qty, unitaryPrice, totalUSD and totalP, totalItem) where total is...
36
3023
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 have set up a Query to show only records that meet a certain criteria...therefore excluding all of the records that do not meet this criteria (just for the record the criteria is any record within my database that falls within two months of its "Due...
3
1504
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 they will have to change errors so this is kinda WHAT ??) the way it is set up is they put in an account number then a person id number (which is text LOL)
2
4851
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 the query is then applied to. However, the 'select all from Sim where it doesn't exists' is the bit I don't get where what doesn't exist? how is the comparison made? I haven't specified a parameter etc.. Any help would be much appreciated.
3
3803
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 anything to work. I know this is probably simple for more experienced Access users. Any help would be greatly appreciated. Thanks Kevin
12
2141
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 makes a choice and the second only shows items which are related to the first box's choice). My problem is that the user can not choose from any of the choices in the second combo... whatever is clicked on the very first item is the only thing that...
0
8249
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8179
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8685
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8493
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6112
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2613
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 we have to send another system
1
1797
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1493
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.