Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SIMPLE SELECT STATEMENT

Author  Topic 

krishna_yess
Yak Posting Veteran

81 Posts

Posted - 2008-09-23 : 06:52:09
My SELECT statement returns following results


------ ------
Item Count
------ ------
a 120
b 100
v 50
d 90
------ ------


i need to put one dummy row at the end. "dummy" is not present in the table.

like this



------ ------
Item Count
------ ------
a 120
b 100
v 50
d 90
dummy 0
------ ------


thanks

Vadivu
Starting Member

31 Posts

Posted - 2008-09-23 : 07:23:05
try adding a union with ur select query like the following

select item, count from [tablename]
union (select 'dummy',0)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-23 : 07:34:28
quote:
Originally posted by Vadivu

try adding a union with ur select query like the following

select item, count from [tablename]
union (select 'dummy',0)



use union all rather than union.union takes distinct of results and hence performance might suffer compared to union all.
Go to Top of Page
   

- Advertisement -