Hi.....
I've a table that contains the students marks.
The fields in the table are:
Sno,m1,m2,m3,m4 ,m5,total,avg,g rade.
im having ten records in the table in which, i've to update the grade column such that:
if the avg if above 80, the grade should be 'first' and 'second' if not.
I've to accomplish this in a single query(nested).
I dont know how to implement this.
Please some body help me in my problem????!!!! !!!!!!!!!!!!
2 3477
Hi.....
I've a table that contains the students marks.
The fields in the table are:
Sno,m1,m2,m3,m4 ,m5,total,avg,g rade.
im having ten records in the table in which, i've to update the grade column such that:
if the avg if above 80, the grade should be 'first' and 'second' if not.
I've to accomplish this in a single query(nested).
I dont know how to implement this.
Please some body help me in my problem????!!!! !!!!!!!!!!!!
So you are to update that field each time a new mark is added (eg when m2 is populated and again when m3 is populated and so forth)?
also is each m# field null until the mark is calculated? (just dont want to assume here)
For this u can use CASE
try this piece of code
update student set grade =
CASE
WHEN avgmark>70 THEN 'A'
WHEN avgmark>60 THEN 'B'
WHEN avgmark>50 THEN 'C'
ELSE
'D'
END
it updates all the rows .
hope it helps u
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: John Pastrovick |
last post by:
I use a function, myrandomPIN (), to generate random PIN numbers.
The following sql query updates records with the SAME PIN number but.
I want to generate DIFFERENT pin numbers for every record. The
function is ok but I can't figure out how to run it individually for
each record. In other words I do not know the correct syntax to use...
|
by: Lauren Quantrell |
last post by:
In VBA, I constructed the following to update all records in
tblmyTable with each records in tblmyTableTEMP having the same
UniqueID:
UPDATE
tblMyTable RIGHT JOIN tblMyTableTEMP ON tblMyTable.UniqueID =
tblMyTableTEMP.UniqueID
SET
tblMyTable.myField = tblMyTableTEMP.myField,
tblMyTable.myField2 = tblMyTableTEMP.myField2,
|
by: Drew |
last post by:
I have a db table like the following,
UID, int auto-increment
RegNo
Person
Relation
YearsKnown
Now here is some sample data from this table,
|
by: Dalan |
last post by:
I'm not certain if this is doable in the manner explained below, but
I'm certain that there have been Access developers who have done
something similar. So whatever insight and assistance that can be
provided will be much appreciated.
There is a separate Update Query (well several) that consolidate
various goods from separate tables for...
|
by: deko |
last post by:
I know I can use Inner Joins in an Update query like this:
UPDATE DISTINCTROW tblA INNER JOIN qryA ON tblA.SomeID = qryA.SomeID SET
Flag = 0
WHERE (Flag = -1);
But I am specifying the new value to overwrite the old value, and just using
the join to narrow the set. If I don't know the new value and need to
select it from another...
| |
by: rayone |
last post by:
Hi folks.
I need advice.
2 options, which do you think is the better option to
display/retrieve/report on the data.
Keep in mind reporting (Crystal), SQL Performance, VB Code, usability,
architecture.
Case 1: On a web page I would like to render a dropdown list
|
by: Siv |
last post by:
Hi,
I seem to be having a problem with a DataAdapter against an Access database.
My app deletes 3 records runs a da.update(dt) where dt is a data.Datatable.
I then proceed to update a list to reflect that the 3 items have been
deleted only to discover that the 3 items appear, however when I click on
them to display their information which...
|
by: Michel Esber |
last post by:
Hi all,
DB2 V8 LUW FP 15
There is a table T (ID varchar (24), ABC timestamp). ID is PK.
Our application needs to frequently update T with a new value for ABC.
update T set ABC=? where ID = ?
|
by: bilibytes |
last post by:
hi,
i am trying to UPDATE multiple rows with mysql. I know how to do it with multiple queries but i think it would be less resource consuming generating mysql query code with php and update all one single step.
here is the method i usually employ:
$value_column_1 = array();
$value_column_2 = array();
for($i = 0; $i<=...
|
by: saagardn |
last post by:
I am using Access 2007 on an XP machine. Is it possible to update one field with multiple values using a single SQL statement? I have tired to do this with the query builder, but keep getting a "duplicate output destination" error (I think it is error #3063). This is the code that Access "builds" for me, but does not run:
UPDATE...
|
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...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
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...
|
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...
|
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...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
| |
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |