473,406 Members | 2,713 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,406 software developers and data experts.

How to most recent records from the following recods sets in SQL Server?

I have table Say tblCallCenter
RowId UserId AttendedDate AttendedTime
711 101521059 2010-11-23 17:41:06.983 priyanka
712 101521059 2010-11-23 17:43:42.220 mihir
3733 114945536 2010-12-04 17:55:53.423 mihir
3739 114945536 2010-12-04 17:59:08.940 shantanu
2673 118295812 2010-12-02 14:29:17.500 mihir
2675 118295812 2010-12-02 14:30:16.110 shantanu
4526 119174372 2010-12-06 17:54:52.977 sarika
4522 119174372 2010-12-06 17:52:45.887 aatif
6564 120184636 2010-12-10 13:17:50.560 mihir
6565 120184636 2010-12-10 13:17:51.947 mihir

The result I want to get from this table should contain No repeted UserId provided that the record should be most recent.
THe result should look like this.

RowId UserId AttendedDate AttendedTime
712 101521059 2010-11-23 17:43:42.220 mihir
3739 114945536 2010-12-04 17:59:08.940 shantanu
2675 118295812 2010-12-02 14:30:16.110 shantanu
4522 119174372 2010-12-06 17:52:45.887 aatif
6565 120184636 2010-12-10 13:17:51.947 mihir

So How should I write a query?
Can anyone help me to?
Thanx in Advance.
Dec 10 '10 #1
5 1780
ck9663
2,878 Expert 2GB
What do you have so far?

~~ CK
Dec 10 '10 #2
Couldn't get you...
Dec 11 '10 #3
ck9663
2,878 Expert 2GB
What query/t-sql/code have you created so far?

~~ CK
Dec 12 '10 #4
I just tried to write
Expand|Select|Wrap|Line Numbers
  1. Select RowId,UserId,AttendedDate AttendedTime from tblCallCenter Where.....?
  2.  
I can't write Where clause to get Most Latest record?

Thank You
Dec 12 '10 #5
yarbrough40
320 100+
look into using the MAX() function
Dec 12 '10 #6

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

Similar topics

2
by: Randy Jackson | last post by:
First of all, I apologize in advance if this is covered somewhere in a FAQ. I did a Google search, but really couldn't find anything. I'm having a problem with a simple select query. I've got...
1
by: Tim Graichen | last post by:
Good morning, I have a sub-form that displays records from a table as a continuous form. The table has several hundred records, but the subform only displays five or six records. The records do...
3
by: manny | last post by:
Problem: how to have query show only most recent records. This query shows all exams in 2005 for particular individual (grades not shown to avoid embarrassing John Slacker!): SELECT...
2
by: Dave | last post by:
How would I write the query for mySQL to get all the records in a table that were written in tha last 10 minutes? I have a timestamp field (fldTime) that automatically inserts the curent time...
9
by: shumit | last post by:
Hi I have a patient table with patient names and visiting dates. I want to select those patients who have visited me at least 6 times and show the dates that they visited ordered by name. I have...
2
by: robert.waters | last post by:
I need to perform the following: - select the most recent X number of records in a table (there is a timestamp field) - select the Nth occurrence of X number of records ex: - most recent 10...
10
by: rousseaud | last post by:
Hello- I'm having a little trouble. I want to create a query that will return the most recent records (by date) for all unique values in a certain field in the query. I'll be pulling data from 3...
13
by: angi35 | last post by:
Hi - working in Access 2000... my goal is to combine fields from two tables in a query: Table 1 has ItemNumber and ItemDescription. There's only one record per ItemNumber. Table 2 has ItemAlias....
1
by: deiv82 | last post by:
Hi, I'm trying to get in my homepage the last 10 product-schedules inserted in my website. These I should get from different tables in my database, that have all the same fields but every table has a...
1
by: Scott Barnette | last post by:
I have a table called project_notes. In this table users submit multiple notes on a daily basis for various projects. Fields: Id, ProjectId, Notes, CreatedOn How can i create a query for the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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
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,...
0
isladogs
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...

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.