SQL Server :: Query To Find The 5th Highest Salary From An Employee Table?
Oct 15, 2010query to find the 5th highest salary from an employee table?
View 2 Repliesquery to find the 5th highest salary from an employee table?
View 2 RepliesI have an employee salary table with fields empId, month, year, salary. I need query for the following - Total salary drown each employee last year - Id of the employee who got highest salary last year. i am getting wrong o/p for these queries.
View 3 RepliesI want to write the query for finding second highest salary in my employee table how to find it??
View 3 RepliesBy right clicking on my database i created a query in server explorer. But where are this query stored can't find them back. I should aspect that their is a folder query's like there is a folder tables but this isn't the case.
View 10 RepliesI want to bind data(For ex: Employee name, Employee ID from Employee) to a dropdownlist and the data should be displayed in dropdownlist as two columns. I don't want to separate this columns by using any special characters like | or '-'. I want to display them as different columns in a dropdownlist.
How can i achieve this using .net and the data i need to retrieve using SQL server 2008.
I am trying to create statitics for game downloads and am having dificulty with a sub part of my query. the goup by command is not having the disired result and i think i have been looking at it too long to see what i am doing wrong. [Code]....
At the moment it is producing each result in many rows when only 4 rows should appear. its the download column that is doing it. needs to be sub queried or something to display total in relation to month,gameid,userid.
Month-download-GameID-UserID
1 1
1 1
1 1
1 1
I am having trouble with this statement
[Code]....
I only want the record with the highest value in the EarnedPoints Column, but I get the error
Column 'customer_locations.City' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
I am trying to display the total points Earned, the Client Name, City and State.
I have a table with 2 columns that lookes something like this:
ChapterID | VersionNumber | VersionID |
1001 | 1 | 1004 |
1001 | 2 | 1005 |
1002 | 1 | 1006 |
1002 | 2 | 1007 |
1002 | 3 | 1008 |
1003 | 1 | 1009 |
1004 | 1 | 1010 |
what I wanna achieve is to have a statement that selects distinct uniqueid's from the chapterID field and with every duplicate I would like to have the record with the highest version number
Below is the result I would like to achieve:
ChapterID | VersionNumber | VersionID |
1001 | 2 | 1005 |
1002 | 3 | 1008 |
1003 | 1 | 1009 |
1004 | 1 | 1010 |
I have tried this statement:
Select Distinct ChapterID, max(VersionNumber) from Versions groupby ChapterID
and it works fine, but when I add the VersionID column like so:
Select Distinct ChapterID, VersionID, max(VersionNumber) from Versions group by ChapterID
it returns an error.
how to find and replace substring in select query
DATA RELEASE FORM $LSB$DRF$RSB$
I am getting frustrated with this problem, I dont know what i did, but now I cannot execute any stored procedured when I could last time.When I use my asp.net application to run the query, it finds the stored procedure but when I execute it is sql management studio it says it cannot find the stored procedure even though it is there.I tried to execute other procedures and the samething happens. Even when I try a simple query it says it cannot find the tableI could execute the query if i placed Use [databasename] in front, but even with this, I cannot execute stored procedures.
View 12 RepliesI'm using ASP.Net with VB (Visual Web Developer 2010) and SQL(Management Studio Express 2008) to create a website that keeps track of employee subscriptions.A date is entered into my database whenever an employee makes a subscription.I need to find a way to send an automatic email to each employee when the current date exceeds the subscription date by one year.
I am unable to use an SQL job as I only have SQL MS express.From other posts I have read it seems the best way to do this is to create a webservice to send emails but I am unsure of how to get the email address for each employee from the database to the web service?Do you guys think a web service is the best way to do this?
I just published my web site, and the problem is, that table can't be found. I'm using SQL Server 2008. I created new user, which is not sa, that I se to work with Sql Server 2008 Express manager. I tried to create sa user ass well on hosting server, but it is not possible, because it's already exists.
I think the problem is, that newuser, can't find dbo. tables, which are created by sa user. If that is problem, how can I solve it? I can't create sa user on hosting machine. Is there maybe some solution in right connectionString?
I'm using this kind of ConnectionString on hosting server:
[Code]....
I have a one sql table, it contain 5 column id, ipaddress, status, datetime, value. I need to find distinct rows as per ipaddress column basic..
View 7 RepliesI have the following attributes in my table
[code]....
how do I create sql query to find out the number of times participant A took part in the club activity?
I got data from different 2 tables and then this selected data trying to insert into new table. Selected data have multiple records.
how may i insert selected multirows into new table which has already been created into db.
Select fname, lname, Addresses.address from Persons Join Addresses on persons.ID = Addresses.PID
The result for this will be multi reocords then how can i insert into new table[already created]. within StoreProcedure
I have partitioned a table and it has been partitioned according to an account id. ie also rows that have accountid =1 will be in A partition and all rows that have accountid = 2 will be in B partition. so now if i execute a query with where condition accountid =1 sql server will search only in A partition. Suppose if i add another condition to it ie where accountid=1 and place="aaa" will this query search only A partition or the entire table?
View 3 Replies[Code]....
i want to insert the result of that query into nother table in my database. please help me find a way to do that.
I am designing a validation form which has a textfiled for inserting Employee ID and a submit button for parsing inserted value. On clicking that button the SubmitButton_Click() validate the inserted value against SQL Server database. The database has a table name EMPLOYEE containing ID and Name of employees. Now I have designed the .aspx page but stuck in the rest of the job.
View 6 RepliesHow to create two primary key in a table using sql query and manually?
View 3 RepliesI have inherited a very old SQL Server Database for a live site, but have been asked to add a new table for invoice recording to it. Fairly easy to do for any new record added from now on, however I run into some issues with selecting older records.I need to find a way to select from 3 tables, see if a record exists in the new table and if not insert a new record to it.My stored procedue so far is (The new table is [Invoicing]:
[Code]....
i have Intime and Outtime of each employee for all the days of 1st,2,3,4 week.There will be a off for 1 day or 2 days for each employees.Based on this i need to calculate consisitency days off assignmanet i.e no of matching days off among employees in percentage.If there are 100 emplyees out of 100 employees 50 people may get week off on the same day(for example sunday).I want result in percentage.result like this
Consistency Days of assignment Across 4 weeks 3 weeks 2weeks
0 2% 0% 0%
1 98% 100% 100%
2 0% 0% 0%
Here 0,1,2 are macthing days off.Across 98% of employees getting 1 days matching in off i.e 98% of employee might off in sunday.For this we need calculate matching days off for all the days from sunday to saturday across 4,3 2 weeks Here 98% of employees getting off in same day.0 indicates 0 days,1 is 1days and 2 is 2 days(for example 50 percentage of people will get off in saturday and sunday)
I am looking for simple asp.net code example showing a simple webform task.
When user clicks a button, a stored procedure fires which runs an update-table query (not pulling any parameters from the user) and returns a count of the number of rows that were updated when the query was run.
Within my stored procedure I have the parameter @RowCount=@@ROWCOUNT.
All sample data I have found online has been C# or VB, but nothing that I can apply to my asp.net program.
Again, this is a simple task that for whatever reason I cannot find examples of online.
i wrote a stored procedure to display the number of days in the particular month.if the person is taking a leave from 26jan to 03feb,using this stored procedure i will split the days as per the months..now i want to pass the employee id in the stored procedure and retrive the total days of the january month this is my code
this is my stored procedure
ALTER PROCEDURE datecheck
@EmpId int,@startdate datetime,@enddate datetime
as
begin
[Code]....
i am having dropdownlist in my webpage,if i select the employee id and month january it will retrive the january days for the particular employee.....
How can generate employee attendance Reports in table bu sql server database 2005 and vb.net 2005 i'm not using crystal reports
View 1 RepliesI have one Store Procedure that generating report ..
For storing the data there , i used many temp. tables. There is many Select Query , little less insert and delete query.
Now if there is huge data around 1 lac in temp table my select query taking to much time and also may be insert and delete query
I added Primary key to all auto Increment Field in temp table. Also defined Clustered index on that primary key as unique Clustered index to improve the performance .
But there is not so much improvement in case of huge temp table.
Right now the whole Store Procedure is taking time to complete around 1.5 days or around 30 hours ..
So i want to increase the performance as much that it completes on nearly 3-4 hours.