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 |
|
dimoss
Yak Posting Veteran
52 Posts |
Posted - 2008-11-11 : 06:57:54
|
| Hi,I have the following query and I am trying to insert the result in a temporary table with an extra 'id_' column (not null, int, identity(1,1)SELECT dik.id, COUNT(mel.id) + 1 AS TotalFROM dik LEFT OUTER JOIN mel ON dik.id = mel.id_aitGROUP BY dik.idHow can I do this?Thank you.www.tabletennis.gr |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2008-11-11 : 07:04:05
|
| [code]CREATE TABLE #dump ( [Id] INT IDENTITY(1,1) , [dikId] INT , [counts] INT)INSERT #dump ( [dikId] , [counts] )SELECT dik.id , COUNT(mel.id) + 1FROM dik LEFT OUTER JOIN mel ON dik.id = mel.id_aitGROUP BY dik.id[/code]Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
|
dimoss
Yak Posting Veteran
52 Posts |
Posted - 2008-11-11 : 07:27:29
|
| Thank you! |
 |
|
|
|
|
|