﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server Newbies  / Remove Grand Total Row...... / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Thu, 23 May 2013 16:52:41 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Remove Grand Total Row......</title><link>http://www.sqlservercentral.com/Forums/Topic1393287-1292-1.aspx</link><description>I'm still not sure, but yes, the statement above deletes ALL rows that contain the free spaces in the two columns.If you only want delete the last row there are several possibilities. For the beginning I wold take an easy way. Using the top clause you can select the primary key value of the "last row" in your table. Then you can delete the row using the primary key value.Let's say there is a column InsertDate in your table und you want to delete only the last inserted row with blanks. Let's also say there is a primary key column Named "Id" in your table.This would be:[code="sql"]declare @IdToDelete int;select @IdToDelete = (  select top (1) Id  from dbo.TableX  where col1 = '' and col2 = ''  order by InsertDate desc  )delete from dbo.TableX where Id = @IdToDelete[/code]Again use a select instead of a delete statement to check the rows the query returns.For a more exactly reply you really should post the table structure you use and some sample data.</description><pubDate>Fri, 07 Dec 2012 08:23:52 GMT</pubDate><dc:creator>WolfgangE</dc:creator></item><item><title>RE: Remove Grand Total Row......</title><link>http://www.sqlservercentral.com/Forums/Topic1393287-1292-1.aspx</link><description>OK. You its right if I use this statement to delete this it will delete it. The whole purpose is that I want the last row to be deleted where the grand total of numbers and blank spaces on the other two columns. So if there is another row with blank spaces shows in the two columns.Is it going to delete those rows with this statement?If it does then I don't think this statement will work.</description><pubDate>Fri, 07 Dec 2012 05:36:25 GMT</pubDate><dc:creator>Grass</dc:creator></item><item><title>RE: Remove Grand Total Row......</title><link>http://www.sqlservercentral.com/Forums/Topic1393287-1292-1.aspx</link><description>You say the rows with the total contain blanks in the first two columns, the other rows do not. So if this is your criteria the query is quite easy:[code="sql"]select * from dbo.TableXwhere col1 = '' and col2 = ''[/code]Try this select to check if it returns the rows you want to delete. If so replace the "select *" by "delete" and these rows will be deleted.[code="sql"]delete from dbo.TableXwhere col1 = '' and col2 = ''[/code]</description><pubDate>Thu, 06 Dec 2012 23:44:54 GMT</pubDate><dc:creator>WolfgangE</dc:creator></item><item><title>RE: Remove Grand Total Row......</title><link>http://www.sqlservercentral.com/Forums/Topic1393287-1292-1.aspx</link><description>I mean my question is that a table have some columns and at the row there is a grand total of a data in the above column. So, if i have 4 columns and the last two columns each row have some numbers which will add at the last row as a total number. The other columns have data also but the last row first two columns doesnt have anything in it just blanks. how to remove the last row.thanks.col1	col2	col3	col4	col5	col6a	b	c	1	2	5d	e	f	4	3	8g	h	i	6	7	5                       11     12	18</description><pubDate>Thu, 06 Dec 2012 18:58:14 GMT</pubDate><dc:creator>Grass</dc:creator></item><item><title>RE: Remove Grand Total Row......</title><link>http://www.sqlservercentral.com/Forums/Topic1393287-1292-1.aspx</link><description>I don't understand your explanations. Post some example data and try to explain again using these data.</description><pubDate>Wed, 05 Dec 2012 23:58:07 GMT</pubDate><dc:creator>WolfgangE</dc:creator></item><item><title>Remove Grand Total Row......</title><link>http://www.sqlservercentral.com/Forums/Topic1393287-1292-1.aspx</link><description>Hi all,I am trying to see if any one can help me on how to remove a grand total row from a table. I have a table in which there are 6 columns. first 3 columns there is some data but at  first 3 columns, last row is blank and the last 3 columns have data which is added at the last 3 row as a grand total. here it is looks like:col1	col2	col3	col4	col5	col6a	b	c	1	2	5d	e	f	4	3	8g	h	i	6	7	5			11	12	18So, the last three column row is grand total and the first 3 columns last row is blank. So, I am trying to delete that but can't.Need helpThanks.</description><pubDate>Wed, 05 Dec 2012 18:43:29 GMT</pubDate><dc:creator>Grass</dc:creator></item></channel></rss>