﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>BBS.PROGENIC.COM / Chat / Coding  / SQL Select Help... / Latest Posts</title><generator>InstantForum.NET v4.1.2</generator><description>BBS.PROGENIC.COM</description><link>http://bbs.progenic.com/</link><webMaster>noreply@progenic.com</webMaster><lastBuildDate>Sun, 23 Nov 2008 13:04:23 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: SQL Select Help...</title><link>http://bbs.progenic.com/Topic14681-9-1.aspx</link><description>You could also use between. Something along the lines of&lt;br&gt;&lt;br&gt;&lt;pre&gt;SELECT TOP 11 * FROM (SELECT row_number() OVER (ORDER BY id desc) AS rownum, column1, column2, etc FROM tablename) AS A WHERE A.rownum BETWEEN (2) AND (11)&lt;/pre&gt;</description><pubDate>Sat, 21 Jun 2008 21:38:17 GMT</pubDate><dc:creator>h4ck-y0u</dc:creator></item><item><title>RE: SQL Select Help...</title><link>http://bbs.progenic.com/Topic14681-9-1.aspx</link><description>&lt;div class="Quote"&gt;&lt;b&gt;proge (6/8/2008)&lt;/b&gt;&lt;hr noshade size="1" class="hr"&gt;try&lt;P&gt;&lt;EM&gt;select top 10 * from tablename where id not in (select top 1 id from tablename order by id desc) order by id desc&lt;/EM&gt;&lt;/div&gt;&lt;P&gt; &lt;P&gt;Thats the one &lt;img align="absmiddle" src="http://bbs.progenic.com/Skins/Common/EmotIcons/Smile.gif" border="0" title="Smile"&gt;  Thanks to everyone who helped &lt;img align="absmiddle" src="http://bbs.progenic.com/Skins/Common/EmotIcons/Smile.gif" border="0" title="Smile"&gt;</description><pubDate>Sun, 08 Jun 2008 18:43:56 GMT</pubDate><dc:creator>Pen</dc:creator></item><item><title>RE: SQL Select Help...</title><link>http://bbs.progenic.com/Topic14681-9-1.aspx</link><description>try&lt;/P&gt;&lt;P&gt;&lt;EM&gt;select top 10 * from tablename where id not in (select top 1 id from tablename order by id desc) order by id desc&lt;/EM&gt;</description><pubDate>Sun, 08 Jun 2008 15:17:22 GMT</pubDate><dc:creator>proge</dc:creator></item><item><title>RE: SQL Select Help...</title><link>http://bbs.progenic.com/Topic14681-9-1.aspx</link><description>Now im more confused, using GBrains suggestion&lt;/P&gt;&lt;P&gt;"&lt;EM&gt;select top 10 * from tablename where id not in (select top 1 id from tablename) order by id desc&lt;/EM&gt;" - I just get the 10 most recent entries, so its not skipping the 1 very most recent.&lt;/P&gt;&lt;P&gt;But, if I take out the descend part...&lt;BR&gt;"&lt;EM&gt;select top 10 * from tablename where id not in (select top 1 id from tablename) order by id&lt;/EM&gt;" - then this will work, it takes the oldest entries and &lt;STRONG&gt;does&lt;/STRONG&gt; skip the first record.&lt;/P&gt;&lt;P&gt;... this doesnt make sense to me but im sure if you test it you'll get the same.&lt;/P&gt;&lt;P&gt;So it kinda works, just gets the oldest data instead of the newest - any ideas?</description><pubDate>Sun, 08 Jun 2008 14:32:43 GMT</pubDate><dc:creator>Pen</dc:creator></item><item><title>RE: SQL Select Help...</title><link>http://bbs.progenic.com/Topic14681-9-1.aspx</link><description>&lt;div class="Quote"&gt;&lt;b&gt;proge (6/8/2008)&lt;/b&gt;&lt;hr noshade size="1" class="hr"&gt;the example 1 in the sql gbrain posted should work, can u post what you tried to use?&lt;P&gt;if you want to do it like anon said i can help, what code are you using to load the data initially?&lt;/div&gt;&lt;P&gt;Hey matey,&lt;P&gt;Just tried GBrains again, the first one like you said - its just selecting the top ten, its not skipping one. At the moment Ive not put it into .NET but it'll be a case of loading it into a DataList.&lt;P&gt;At the moment im just using Query Analyzer with the data til I get the Select statement working.</description><pubDate>Sun, 08 Jun 2008 14:28:23 GMT</pubDate><dc:creator>Pen</dc:creator></item><item><title>RE: SQL Select Help...</title><link>http://bbs.progenic.com/Topic14681-9-1.aspx</link><description>the example 1 in the sql gbrain posted should work, can u post what you tried to use?&lt;/P&gt;&lt;P&gt;if you want to do it like anon said i can help, what code are you using to load the data initially?</description><pubDate>Sun, 08 Jun 2008 09:47:37 GMT</pubDate><dc:creator>proge</dc:creator></item><item><title>RE: SQL Select Help...</title><link>http://bbs.progenic.com/Topic14681-9-1.aspx</link><description>&lt;div class="Quote"&gt;&lt;b&gt;Pen (6/8/2008)&lt;/b&gt;&lt;hr noshade size="1" class="hr"&gt;thats what I wanna know how to do &lt;img align="absmiddle" src="http://bbs.progenic.com/Skins/Common/EmotIcons/Smile.gif" border="0" title="Smile"&gt;&lt;/div&gt;&lt;br&gt;Well, the SQL would just be 'select top 11 * from tablename order by id desc', the result of that would be stored in some kind of array. Getting rid of the first element of an array is called "shifting", how to do it in the language you're using shouldn't be hard to find. The function is probably called "Shift()" or something.&lt;br&gt;&lt;br&gt;Good luck!</description><pubDate>Sun, 08 Jun 2008 07:42:55 GMT</pubDate><dc:creator>G-Brain</dc:creator></item><item><title>RE: SQL Select Help...</title><link>http://bbs.progenic.com/Topic14681-9-1.aspx</link><description>Anonymoose - thats what I wanna know how to do &lt;img align="absmiddle" src="http://bbs.progenic.com/Skins/Common/EmotIcons/Smile.gif" border="0" title="Smile"&gt;&lt;/P&gt;&lt;P&gt;GBrain - Thanks for searching matey, I found those examples aswell - The first didnt seem to work if the column held anything other that integer data, and the second I think was for MySQL.</description><pubDate>Sun, 08 Jun 2008 07:36:47 GMT</pubDate><dc:creator>Pen</dc:creator></item><item><title>RE: SQL Select Help...</title><link>http://bbs.progenic.com/Topic14681-9-1.aspx</link><description>Google gives me this:&lt;br&gt;&lt;br&gt;&lt;b&gt;1&lt;/b&gt;&lt;pre&gt;select top 10 * from tablename where id not in (select top 1 id from tablename) order by id desc&lt;/pre&gt;&lt;br&gt;&lt;b&gt;2&lt;/b&gt;&lt;pre&gt;select * from tablename order by id desc limit 1,10&lt;/pre&gt;&lt;br&gt;The top 1 part could probably be done better and the other method looks kinda slow, give it a try though. Anonymoose's suggestion is probably the fastest.</description><pubDate>Sun, 08 Jun 2008 05:39:35 GMT</pubDate><dc:creator>G-Brain</dc:creator></item><item><title>RE: SQL Select Help...</title><link>http://bbs.progenic.com/Topic14681-9-1.aspx</link><description>Could you not do Top 11 instead and skip the first result returned? Or is that what you were asking how to do...  Sorry, it's early!</description><pubDate>Sun, 08 Jun 2008 05:31:44 GMT</pubDate><dc:creator>anonymoose</dc:creator></item><item><title>SQL Select Help...</title><link>http://bbs.progenic.com/Topic14681-9-1.aspx</link><description>I have a database that is constantly being added to... what im trying to do is select the 10 most recent entries EXCEPT for the very most recent.&lt;/P&gt;&lt;P&gt;Selecting the 10 most recent is something I can do.... 'select top 10 * from tablename order by id desc' - but how do I leave out the most recent?&lt;/P&gt;&lt;P&gt;SQL Server 2005.</description><pubDate>Sun, 08 Jun 2008 02:35:01 GMT</pubDate><dc:creator>Pen</dc:creator></item></channel></rss>