Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: bradbury9 Newsgroups: comp.databases.ms-sqlserver Subject: Re: Database query -- how to? Date: Thu, 12 Apr 2012 02:28:32 -0700 (PDT) Organization: http://groups.google.com Lines: 35 Message-ID: <33102916.190.1334222912192.JavaMail.geo-discussion-forums@vbbbg2> References: <67dc35a7-ea2e-4eb1-8bd4-7c7218c1e8e2@2g2000yqp.googlegroups.com> NNTP-Posting-Host: 195.57.19.36 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1334222912 8760 127.0.0.1 (12 Apr 2012 09:28:32 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 12 Apr 2012 09:28:32 +0000 (UTC) In-Reply-To: <67dc35a7-ea2e-4eb1-8bd4-7c7218c1e8e2@2g2000yqp.googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=195.57.19.36; posting-account=jIl9nQoAAAA9P37IIqQq64yAx-2NQYiu User-Agent: G2/1.0 Xref: csiph.com comp.databases.ms-sqlserver:972 El jueves, 12 de abril de 2012 10:02:09 UTC+2, Gerd Brix escribi=F3: > Hi all, >=20 > I'm not too firm with writing SQL queries, thats why I'm asking here > for help. > There's a SQL Server Express with the following table: >=20 > ID TIME > ---------------- > 1 8:00 > 1 7:45 > 2 6:00 > 3 5:00 > 2 7:59 >=20 > What I need to find out is the last time entered for all given IDs. > That means: > ID TIME > ---------------- > 1 8:00 > 2 7:59 > 3 5:00 >=20 > Can someone please help me with this? >=20 > Thanks in advance! >=20 > -gerd In case the column TIME is DateTime type: Select max(TIME) from TableName If i is not DateTime, you will have to convert the data, heres a link to th= e documentation on Convert function and data types http://msdn.microsoft.co= m/es-es/library/ms187928.aspx