How To Obtain The Students'name With Highest GPA
Apr 12, 2006
I want to obtain the top 1 students' name in each grade,but this code
dosen't work:
select top 1 name
from student
group by grade
order by GPA desc
Can anyone tells me what to do?
View 6 Replies
ADVERTISEMENT
Aug 11, 2005
Hi,
I want to get all the student from a Database table which store student certificate. For example, I need a query of student who "HAVE" 3 certificate(Cert A, B, C).
Certificate Table:
StudentName CertificateName
John Cert A
Wilson Cert B
John Cert B
John Cert C
Michael Cert A
Output:
John
sqlQuery = "Select * from CertificateTable Where (CertificateName = 'Cert A') AND (CertificateName = 'Cert B') AND (CertificateName= 'Cert C')"
This is my query, but it not works.
Calvin
View 2 Replies
View Related
Nov 19, 2006
Hello!
My name is Dr. James Triton. I am working on a research program for an unnamed University. Without getting into too much detail, I was wondering if any lower level college (or perhaps late high-school, depending on the strength of your Computer Science program) would be interested in filling out a few SQL queries, making an ER model or DDLs for a database.
Here is some example questions:
1.List each employee's first name, middle initial, and last name, concatenated to form a single value, as well as how many years they have been working for the company. An example name would appear as "JOHN Q SMITH". Sort the output by descending number of employment years. (HINT: create a column alias.)
2.List all of the job functions (such as "CLERK"), and the last names of all employees associated with each function. Order the output alphabetically by the functions. (HINT: there are a total of seven different functions.)
3.List the last name of every manager, along with the last names of the employees that the manager manages. Create column aliases "MANAGER" and "EMPLOYEE", and order the output by manager last name.
(there are 15 such queries)
The table for these is located here:
Please email me if you are interested!
~Dr. James Triton~
Edit : Links removed.
View 5 Replies
View Related
Jan 16, 2008
Hello i am doing my final project in my University and i have chosen to do a beta my university portal.I am facing a problem because i don't know how to link students with his specific data when he logs in to the site for example i want to show his specific grades when he logs in or anything else that is related to himand this is what i am using to show the grades with the use of data grid 1 SELECT Student.StudentiId, Student.StudentName, Student.StudentSurname, Course.Course, Exams.Datewritten, Exam.Exam, Exams.Grade2 FROM Student 3 INNER JOIN 4 Exams 5 ON Student.StudentiId = Exams.Studentid 6 INNER JOIN 7 Course 8 ON Exams.Courseid = Course.Courseid 9 INNER JOIN10 Exam 11 ON Exams.Examid = Exam.Examid; I am very confused since i dunno how to do thisShould i need to relate the asp.net membership database with mine?P.S my vb.net skills are low Here is my database Schema
View 8 Replies
View Related
Aug 31, 2014
In a sql server 2012 database, I have a field called date of birth that is stored in a tha that is stored in a datetime format. I need to determine the age of various students in the school system. Thus can you show me sql to that I can use to determine the a child is currently?
View 6 Replies
View Related
Jul 20, 2005
I haven't a clue how to accomplish this.All the data is in one table. The data is stored by registration dateand includes county and number of students brokne out by grade.Any help appreciated!Rob
View 4 Replies
View Related
May 26, 2006
Hi! i have a column named number(int),ref_number(char),date(date),creator(ch ar)...what would be my query string, if posible, to get the highest value for clumn 'number'? by the way im using SQL Desktop Engine... any inputs will be greatly appreciated...thanks in advanace!
View 3 Replies
View Related
Nov 14, 2006
I'm using sql server 2005, I created a customer table and set the customer_id as an uniqueidentifier that is a NEWSEQUENTIALID()...when a user is created I want to obtain the last customer_id so that I can insert it in another table that has a one to many relationship with the customer table. Please help...how do i do this?.Thanx
View 3 Replies
View Related
Mar 1, 2001
I'm working on a search engine right now, and I am querying out a set amount of information at one time. How can I grab the last row count of a query, and use that as a starting point, or index when a "Next 100" is pressed. For instance, a person searches through a user table, but only wants 25 users at a time. So the beginning index is 0 to 25. In my query, I have "SELECT TOP 25 from users", but now when the person searching want's to move to the next 25 users, so the index would be 26 to 50, how can I hold the last row displayed? It gets a little more complex also, if a user is searching by last name, the rows will be staggered. Is there a SQL function which will grab the number of the last row displayed? I've looked through the SQL Book, and was unable to find a function that does this, or anything close to it. I hope I made sense of this question, if you need more information, email me and I will try to clarify. Thank you for any information or hints.
View 1 Replies
View Related
Feb 9, 2005
If I have say 20 records of sales employees, for example, how can I get the top 3 locations for $$$sales for EACH employee? Each employee can have multiple locations where they have sold(let's say up to 50). I only want the names of the top 3 locations. The closest I can get is filtering the dataset by a HAVING clause > a dollar amount but this still gives me between 3 - 12 records for each plus I have to literally enter each salesperson's number as it stands now. Is this a loop or a cursor? Thanks.
ddave
View 14 Replies
View Related
Oct 3, 2006
Hi all!
How can I obtain message_id when I SEND the message, before I execute RECEIVE statement?
Thanks a lot for the help!
View 9 Replies
View Related
Jul 20, 2005
Hi all,Given:f1 f2-- --1 a2 b3 b4 b5 c6 c7 dHow to get the highest count for field f2, output as:f2 f2count-- -------b 3
View 1 Replies
View Related
Jan 23, 2008
I have four columns that include numbers like: A B C D
I want to update D with highest value of A, B or C.
For example A = 1, B = 2, C= 3 then D should be 3.
Can you help me?
View 1 Replies
View Related
Feb 5, 2003
Hi,
i need to run a restore of a database overnight onto a different server using the live data .bak file. however the job failed on the first run (last night) with the error:
"Exclusive access could not be obtained because the database is in use. ...."
how do i gain this Exclusive use via an SQL statement please?
View 8 Replies
View Related
Feb 2, 2006
Hi all!
I have a new computer, clean, I installed WinXP, and I want to connect a SQL Server (other computer in the same network)
For this I installed the client tools from SQL SERVER 2000 kit. Ok.
When I try to connect to the server, I can't connect through "trusted connection", only whit user name and password.
I mention that I set the sql server in mixed mode autentification.
When I try to connect from other computer (my laptop, or other computer from this network) I can connect both types of connection: trusted and with
sa (for example)
The question is:
How I can set up a "trusted connection" at SQL Server?
The computer is completely new, clean and has win xp with sp2.
Any opinion are considered.
Thanks in advance.
koci.
View 2 Replies
View Related
Feb 2, 2006
Hi all!
I have a new computer, clean, I installed WinXP, and I want to connect a SQL Server (other computer in the same network)
For this I installed the client tools from SQL SERVER 2000 kit. Ok.
When I try to connect to the server, I can't connect through "trusted connection", only whit user name and password.
I mention that I set the sql server in mixed mode autentification.
When I try to connect from other computer (my laptop, or other computer from this network) I can connect both types of connection: trusted and with
sa (for example)
The question is:
How I can set up a "trusted connection" at SQL Server?
The computer is completely new, clean and has win xp with sp2.
Any opinion are considered.
Thanks in advance.
koci.
View 3 Replies
View Related
Oct 5, 2006
Hi,
I have a date column and I am trying to build a query that will give me the dates > 48 hours ago (in the past).
For example using todays date 2006.10.05 and time 23:00 I would be looking for the dates prior to 2006.10.03 and time 23:00.
Your help is greatly appreciated!
Thanks!
View 2 Replies
View Related
Aug 7, 2005
i need to programmatically obtain and the process constraintinformation. the problem with the output from sp_helpconstraint isthat it outputs two resultsets. (the 2nd resultset is exactly what ineed though)as far as i know i can't stick this output into a temp table to thenprocess with cursors or anything like that. i'm trying to directlyaccess all kinds of sytem tables but not getting the complete info thatthe 2nd resultset that sp_helpconstraints offers.(E.g. sp_helpindex is more useful as it outputs only one resultset ofinformation so i could programmatically use that output to do what ineed to do)any suggestions? thanks.
View 1 Replies
View Related
Aug 7, 2005
i need to programmatically obtain and process constraint keyinformation. the problem with the output from sp_helpconstraint isthat it outputs 2, and sometimes 3 resultsets. (the 2ndresultset/constraint_keys is exactly what i need however)because the resultsets vary in output format, i cannot programmaticallyuse the output to process in my DB proc. its essentially useless tome. i can only suppress the 1st resultset (with tablename info), andcannot suppress the occasional 3rd resultset (that has referencingforeign key info).i've tried to directly access all kinds of sytem tables but i'm notgetting the complete info that the 2nd resultset thatsp_helpconstraints offers.any suggestions? thanks.
View 3 Replies
View Related
Jul 20, 2005
Sorry for my englishI have a table that contains data of career about the person (staff)like this ...EMATREANIDEMEIDEGIIDecc. ..ecc. ..ecc. ..ecc. ..1199912312002123111200311000321999123120021231122003110003419991231200073115199912312001131161999123120021231162003110003719991231200212311whereEMATR is a not unique key (person ID)EANID, EMEID, EGIID (assembled) are the date of the last advance ofcareerI want extract from the table below only the actual position,therefore a view that return this rowsEMATREANIDEMEIDEGIIDecc. ..ecc. ..ecc. ..ecc. ..1200311000322003110003419991231200073115199912312001131162003110003719991231200212311I hope of to have been explainThank you from Maximiliano (italy)RE-Sorry for my english--Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
View 1 Replies
View Related
Jan 25, 2007
i read from msdn that i need a certificate for me to be able to configure SSL which will allow me to replicate on my publication. it says that i can obtain a certificate from a certification authority (CA). do i have to pay for it?
there is a SelfSSL that i can dowload and use for 7 days have anyone of you tried this before?
thanks a lot:)
View 3 Replies
View Related
Sep 26, 2007
I have license information about the SQL Server 2005 Standard Edition.
Is there any possibility for me to download the media or should I need to obtain DVD only?
Regards,
NithyaPriya
View 1 Replies
View Related
Aug 16, 2006
Hi everyone,
I'm stuck with this silly thing but I haven't idea how to obtain the path for the log file specified in a SSIS package programatically.
This snippet of code works fine:
Dim pkg As New Microsoft.SqlServer.Dts.Runtime.Package
Dim app As New Microsoft.SqlServer.Dts.Runtime.Application
Dim pkgResults As DTSExecResult
pkgLocation = "C:Documents and Settings40990880Mis documentosVisual Studio 2005ProjectsProyecto de SSIS3Proyecto de SSIS3ProvaPrimera.dtsx"
pkg = app.LoadPackage(pkgLocation, Nothing)
pkgResults = pkg.Execute()
After execution I'd like to see the log file which is allocated in the same place than DTSX file. But how??
Using pkg.LogProviders.Item(0).Name appears description reference "SSIS log provider for Text files1" but no the name of the file or its path
Thanks in advance for any thought or advice,
View 6 Replies
View Related
Feb 27, 2007
Can someone tell me what the highest value (number) is for an int data type in sql server 2005?
View 2 Replies
View Related
Jun 19, 2007
Hai frendz,
I am having a table named Employee(int EID, float Salary)...
Now I want to select the highest salary in the table and the query is-
"select top 1 EID, Salary from Employee ORDER BY Salary DESC"
Now I need to write a query which selects the second highest salary.
So how to achieve this?..
thanx
View 6 Replies
View Related
Sep 26, 2004
hello all,
i'm not new to SQL but i cant seem to get this right:
hope some one will:
how to find highest unique number of a certain column(val)for a specific name(name is in INPUT parameter)
i.e :
id | name | val
---------------
1 | name1 | 2.7
2 | name1 | 3.5
3 | name1 | 3.5
4 | name1 | 3.5
5 | name1 | 1.3
6 | name2 | 3.1
7 | name2 | 3.1
8 | name2 | 2.9
requested result:
if input param(name)=name1
result:
1 | name1 | 2.7
if input param(name)=name2
result:
8 | name2 | 2.9
hope some one can write the sql cmd for this
i'll be grateful !
thank you!
View 3 Replies
View Related
Dec 8, 2004
Got a table with salestatistics and I want to know what ItemNr sold most a certain day. Can anyone help me with the SQL?
View 1 Replies
View Related
Sep 21, 2004
Hello,
I have the following problem.
I have three Columns
name / version / package
I want to create a select query, that shows me all names and their actuall package. The actual Package is the record with the highest version number.
For Example my Database has the following entries :
name / version / package
name1 / 1 / package1
name2 / 1 / package1
name2 / 2 / package3
name3 / 1 / package2
The output should look like this :
name1 / 1 / package1
name2 / 2 / package3
name3 / 1 / package2
Has anyone a idea and can help me ?
Thanks in Advance
Mirco
View 4 Replies
View Related
Aug 26, 2004
Hi all,
Hopefully you can assist this pleb (me) with some (hopefully) basic scripting.
I have a table which has bucket loads of rows in it (funnily enough)
Field1 & Field2
Field1 is repeated numerous times (but also has differing values) through the table
Field2 is a numeric value which is assigned to the Field1
What I need to do is pull back all the unique Field1's but only those with the highest value in Field2
Example:
Field1 Field2
blah 100
blah 400
blah1 12
blah1 9
blah1 2
blah 350
I need the return to be basically:
Field1 Field2
blah 400
blah1 12
I am sure that this has to be straight forward - however my brain just isn't connected the right way at the moment....
Thanks in advance for any assistance on this.
Troy
View 2 Replies
View Related
Jan 12, 2012
I am attempting to create a report that will display all the yearly, and monthly gas production for a company but the issue I am encountering is finding amended records for a lease. Below is what the query produces:
Company Number Year Month Gas Production Lease Number
3125 20091 296 9105701
3125 20091 345 165207
3125 20091 565 2250593 <--
3125 2009 1 1161 2250593
I would like to omit the lower production gas production, and keep the higher production from the same lease.
View 3 Replies
View Related
Sep 25, 2006
I have a table stock, on the table I have company_name, stock_value, sector.
Now I want to get top five rows from this table depending on the five highest value of stock_value and for each sector. The query has to run on both oracle DB and Microsoft SQL Server with top priority MSSQL.
I will appreciate if you help me on this
jideofor
View 2 Replies
View Related
Mar 25, 2008
Hi,
I need help on this one. Let's say I have a table like this:
Table_ID Value SomeOtherTable_ID
1 2 1
2 4 1
3 1 2
4 5 3
5 3 2
6 0 1
How can I get only two rows of each SomeOtherTable_ID? The result that I want is this:
SomeOtherTable_ID Value
1 4
1 2
2 3
2 1
3 5
Thanks in advance
View 2 Replies
View Related
Mar 14, 2000
I need to be able to obtain the storage space used for database log files through T-SQL commands.
I can do this in version 6.5 but have been unable to accomplish this in version 7.0.
Does anyone have a suggestion?
View 2 Replies
View Related