-
SQL query help needed
I need to update a field in a table where two other fields meet certain criteria.
i.e. as seen below I m trying to update Cost to £100 where the SeasonName is Low and the CategoryID is B1
Here is what i have so far.
UPDATE Cost
SET Cost = 100
WHERE (SeasonName = 'Low') & (CategoryID = 'B1')
;
I realise I am updating the whole field column, how do i just update one specific cell matching the criteria specified
Help would be very appreciated.
-
What database are you using?
Also I don't understand what you mean by
I realise I am updating the whole field column, how do i just update one specific cell matching the criteria specified
Sounds like you are updating Excel cell.
-
Using MS Access
I have a table and it contains data such as below.
CatID SeasonID Cost
A1 Low
B1 High
C1 Medium
I need update the cost field depending on the criteria so if CatID is A1 and season is Low cost will = £100
Does that explain it better?
-
You are on the right track,
How about
UPDATE Cost
SET Cost = 100
WHERE SeasonID = 'Low'
AND CatID = 'B1';
Assuming table name is also Cost.
-
YOU ABSOLUTE BEAUTY
Nearly had it though, I had "&" instead of "AND"
Thankyou very much skhanal
No doubt i will be in touch again
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|