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.
| Author |
Topic |
|
mdelgado
Posting Yak Master
141 Posts |
Posted - 2002-10-30 : 12:05:18
|
| Hello all...I would like to run a query that displays the results of a table with a counter. I found that by using the following code in a derived table I can provide a "1 column" view with a numerical sequence:select top 100 percent * from( select (a0.id + a1.id + a2.id) as id from (select 0 id union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) a0, (select 0 id union select 10 union select 20 union select 30 union select 40 union select 50 union select 60 union select 70 union select 80 union select 90) a1, (select 0 id union select 100 union select 200 union select 300 union select 400 ) a2 -- ... )mwhere id >0order by idI would like to use the above code with a CROSS JOIN to an existing table to retrieve a resultset with a "Counter".I know that i can do this using create table statements then inserting a new column, but I really want to do this in one step in a view and use that with xp_sendmail to sent the results in an Email.Any help would be much appreciated. |
|
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2002-10-30 : 12:33:31
|
| Can you post the table structure, some sample data and expected results. |
 |
|
|
|
|
|