473,395 Members | 1,856 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,395 software developers and data experts.

Help Needed For writting a query (SQl Server 2005).

Hi experts,

I am working on SQL Server 2005.
Now i have to write a query which will extract some data from 3 to 4
tables.
My main table is having few columns supose 4 columns.

EmpNo EmpName Date_Of_Joining Date_Of_Appraisal

Now records are entering in this table. But here If any emp gets any
appraisal the a new row is entered and first 3 coluns will be same.

for ex

EmpNo EmpName Date_Of_Joining
Date_Of_Appraisal
1 John 21/01/2000 24/01/2001
1 John 21/01/2000 20/01/2002
1 John 21/01/2000 2/01/2007
1 John 21/01/2000 1/01/2008
Now i have to write a query which will have all these columns
and if there is any employee who is having more than one row in the
table then one extra column will be added in the result and It will
show you the 5 columns
And only last two rows will be taken and result will be like this

EmpNo EmpName Date_Of_Joining
Last_Date_Of_Appraisal Previous_Date_Of_Appraisal
1 John 21/01/2000 1/01/2008 2/01/2007
How i can get this result, Please help me.

Any help wil be appriciated.

Regards
Dinesh
Feb 15 '08 #1
0 1132

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
by: stu_gots | last post by:
I have been losing sleep over this puzzle, and I'm convinced my train of thought is heading in the wrong direction. It is difficult to explain my circumstances, so I will present an identical...
5
by: - | last post by:
Hello to all I need help on some sql statements and wondering is anyone out there is able to help. I've extracted some data from the database into a new table consisting of 4 fields CustomerID...
13
by: Mike | last post by:
Normally scheduling a job is a very elementary operation but for some hidden reason I've been unable to schedule a job which runs on a 28 day cycle, even though I have at least 16 other jobs...
0
by: jaggee | last post by:
Hello, This is regarding log analysis of a web system, I am finding my backend SQL programming has taken so much of time to process the application due to following quires for a log table having...
4
by: T. Wintershoven | last post by:
Hi Can someone please tell me whats wrong with the last line of the query below. The first three lines work fine but when i add the fourth line i get an error message (see text at ERROR...
4
by: Pumkin | last post by:
Hello guys, I need help in something as I don't know if it is possible what I want. I have a select like this... SELECT Cod1 as SQL, Cod2 as Oracle FROM table and I need to sort by alias SQL...
0
by: mandrax7 | last post by:
I used Visual Studio 6 and I had made a simple program to access a SQL 2000 database, now I'm trying to do the same thing with Visual studio 20005, but.....nothing works. I used to connect with...
2
by: Dinesh | last post by:
Hi experts, I am working on SQL server 2005 reporting services and i am getting a problem in writting a query. Situation is given below. There is one table in database Named Child Now i...
2
by: Dinesh | last post by:
Hi experts, I am working on SQL Server 2005. Now i have to write a query which will extract some information from a table. My main table is having few columns supose 3 columns. EmpID ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.