473,394 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Alter a Query

For example: I have one query that generate a table (student), with 3 columns (ID, Name, and Grade).

ID Name Grade
1 Amy 98
2 Ben 85
3 John 70

I will like to do to another Select query on top of this query, which i can select ID, Name, and Grade. If the grade is over 90, i will like to save the grade as "good grade"; between 80 to 90 as "OK grade"; below 80 as "bad grade".

So the second query will show like:
ID Name Good Grade OK grade Bad Grade
1 Amy 98 0 0
2 Ben 0 85 0
3 John 0 0 70

Is it possible to do that?
3
Feb 19 '08 #1
1 1876
cori25
83
Hello...

1.) In the query bring in ID, Name, Grade

2.) Then you will need to create the following fields within this query:

Good Grade:iif([Grade]>90, "Good", "")
Criteria: Good

Satisfactory Grade:iif([Grade]Between 80 And 90, "Satisfactory", "")
Criteria: Satisfactory

Bad Grade:iif([Grade]<80, "Poor", "")
Criteria: Poor

Put in the criteria so that under the Good Grade column only Good will pull in for that field and so on...

Thanks
Feb 19 '08 #2

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

Similar topics

2
by: Heist | last post by:
Hi, I just want to know to turn this: CREATE TABLE . ( NOT NULL , (50) COLLATE French_CI_AS NULL , NOT NULL , (50) COLLATE French_CI_AS NOT NULL , NULL , NULL ) ON into this:
7
by: Jon Combe | last post by:
I have created the following test SQL code to illustrate a real problem I have with some SQL code. CREATE TABLE JCTable ( CustomerName varchar(50) ) ALTER TABLE JCTable ADD CustomerNo int...
1
by: boonkit | last post by:
I try to get better performance by implementing this: http://dev.mysql.com/doc/mysql/en/alter-table.html "ORDER BY allows you to create the new table with the rows in a specific order. Note...
7
by: pb648174 | last post by:
I am trying to add a column to a temp table and then immeditaely query against that new column. If I do this in Query Analyzer it works fine as long as there is a go in between, but I can't use a...
0
by: Gianfranco | last post by:
Hi, I'm not familiar at access and at VBA either, so I need some help or at least some hint please. I have table "availabledrivers", coming from a query to the table "drivers". Then I have a table...
4
by: Jeff Kish | last post by:
Hi. I have a database I need to supply something (I'm assuming a t-sql script.. maybe something else is better) to update customer tables with. The operations include mostly changing varchar...
2
by: Jeff_in_MD | last post by:
Hi, I'm trying to add a column to a table, then update that column with a query. This is all within a single batch. Sqlcmd gives me an error on the update, saying "invalid column xxx", because...
6
by: Barry | last post by:
In sqlserver 2000 I have a UDF which works fine but I want to make a change to it. When I do an ALTER FUNCTION ... I get an error saying that I can't alter the function because it is referenced by...
1
by: prosad | last post by:
hi, have a mysql query that orders entry by complaint category. this query is then used with mysql_fetch_array to generate table of records ordered by complaint and other parameters. i can alter...
1
by: Chris | last post by:
Hi, I am trying to run the following SQL through the DB2 command line for version 9.1.0: alter table SCHEMA.TABLE1 drop column A; alter table SCHEMA.TABLE2 alter column B set data type...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
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
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...

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.