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 |
|
programer
Posting Yak Master
221 Posts |
Posted - 2011-12-17 : 15:37:39
|
| Imam Tabela 1 in table2struktura:Tabela 1Id, Type, Višina12, 4, 1013, 4, 2514, 4, 49Ce i shranjeni v Type Tabela 1 = 4, je treba s prožilcem najti vrstici 1 in 3 v Tabela 1 in shraniti:table2id, Znesek1, 102, 49Torej, je treba najti vrstic 1 in 3. Iskanje preko id (12, 14) je izkljucena. Moram najti vrstice, 1,2,3 ....Kako najti vrstice z sproži? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
programer
Posting Yak Master
221 Posts |
Posted - 2011-12-17 : 16:01:17
|
quote: Originally posted by tkizer Could you please translate to English? Only one that I know of that speaks Slovenian here is Mladen, not sure here's going to see this thread.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog
Sorry,I have a table 1 and table2structure:Table 1Id, Type, Amount12, 4, 1013, 4, 2514, 4, 49If i stored in Table 1 Type = 4, it is necessary to find a trigger rows 1 and 3 in Table 1 and to save:table2id, amount1, 102, 49So, it is necessary to find rows 1 and 3 search by id (12, 14) is excluded. I need to find rows 1,2,3 ....How to find row with trigger? |
 |
|
|
programer
Posting Yak Master
221 Posts |
Posted - 2011-12-17 : 16:16:21
|
quote: Originally posted by programer
quote: Originally posted by tkizer Could you please translate to English? Only one that I know of that speaks Slovenian here is Mladen, not sure here's going to see this thread.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog
Sorry,I have a table 1 and table2structure:Table 1Id, Type, Amount12, 4, 1013, 4, 2514, 4, 49If i stored in Table 1 Type = 4, it is necessary to find a trigger rows 1 and 3 in Table 1 and to save:table2id, amount1, 102, 49So, it is necessary to find rows 1 and 3 search by id (12, 14) is excluded. I need to find rows 1,2,3 ....How to find row with trigger?
I tried like this:select Row_Number() Over (Order by ID) As Row from table1INSERT INTO table2 (Odds) VALUES (select Row from table1);I want to find in the table1 first and second row and then to save in the table2 data from table1.If I have in the table1Id, Amount50 1060 25 70 49Row=1 and Row=3.... in the second table to save 10 and 49.How to do this? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-18 : 00:33:45
|
whats the significance of 1 and 3 positions? and your explanation says I want to find in the table1 first and second rowanyways here you go with first and third rows. if you want first and second change rn values accordinglyINSERT INTO table2 (id, amount)SELECT id, amountFROM(SELECT ROW_NUMBER() OVER (PARTITION BY Type ORDER BY id ASC) AS Rn,id, amountFROM table1)tWHERE Rn IN (1,3) ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|