Click here to Skip to main content
15,887,869 members
Home / Discussions / Database
   

Database

 
AnswerRe: Referencing DacPac file from different Server and Database Pin
Mycroft Holmes19-Oct-15 14:30
professionalMycroft Holmes19-Oct-15 14:30 
QuestionLimiting the scope of a Table variable Pin
indian14317-Oct-15 6:35
indian14317-Oct-15 6:35 
AnswerRe: Limiting the scope of a Table variable Pin
Mycroft Holmes17-Oct-15 13:40
professionalMycroft Holmes17-Oct-15 13:40 
GeneralRe: Limiting the scope of a Table variable Pin
indian14319-Oct-15 10:28
indian14319-Oct-15 10:28 
QuestionMove GROUP_CONCAT's comma values to columns Pin
Jassim Rahma15-Oct-15 6:45
Jassim Rahma15-Oct-15 6:45 
AnswerRe: Move GROUP_CONCAT's comma values to columns Pin
Jassim Rahma15-Oct-15 8:02
Jassim Rahma15-Oct-15 8:02 
GeneralRe: Move GROUP_CONCAT's comma values to columns Pin
Jassim Rahma24-Oct-15 1:28
Jassim Rahma24-Oct-15 1:28 
QuestionFilling many to many rel table using Select statement Pin
indian14314-Oct-15 7:18
indian14314-Oct-15 7:18 
Hi All,

I have Table A, TabB and TableC, I need to fill TableC by using Select statement and join on TableB and TableA two times. Because TableC is a many to many relationship table on TableA and TableB.
TableA(Id, Name, Desc)
TableB(Id, TableAId, AnotherTableAId, TableAName, AnotherTableAName)
TableC(Id, TableAId, AnotherTableAId, TableAName, AnotherTableAName)
Now the problem is TableA fills the new Data and TableC should be synced to TableB but should have new Ids from TableA and same TableAName, AnotherTableAName values from Old TableB rows. If I run as below, the rows aren't coming correctly, some times more rows than in TableB or some time less rows than in TableB.

Here is how I tried but failed, any suggestion or link or even code snippet would help a lot.
Insert into TableC (TableAId, AnotherTableAId, TableAName, AnotherTableAName)
SELECT TableAId, AnotherTableAId, TableAName, AnotherTableAName FROM TableB b
INNER JOIN TableA a ON a.Name = b. TableAName
INNER JOIN TableA a2 ON a2.Name = b. AnotherTableAName
Please help me with this, thanks in advance.
Thanks,

Abdul Aleem

"There is already enough hatred in the world lets spread love, compassion and affection."

AnswerRe: Filling many to many rel table using Select statement Pin
Mycroft Holmes14-Oct-15 12:50
professionalMycroft Holmes14-Oct-15 12:50 
GeneralRe: Filling many to many rel table using Select statement Pin
KDGOLE14-Oct-15 21:27
KDGOLE14-Oct-15 21:27 
GeneralRe: Filling many to many rel table using Select statement Pin
indian14317-Oct-15 6:17
indian14317-Oct-15 6:17 
GeneralRe: Filling many to many rel table using Select statement Pin
indian14319-Oct-15 10:30
indian14319-Oct-15 10:30 
QuestionGet check time from separate fields in Microsoft SQL Server Pin
Jassim Rahma14-Oct-15 0:11
Jassim Rahma14-Oct-15 0:11 
AnswerRe: Get check time from separate fields in Microsoft SQL Server Pin
Mycroft Holmes14-Oct-15 1:11
professionalMycroft Holmes14-Oct-15 1:11 
GeneralRe: Get check time from separate fields in Microsoft SQL Server Pin
Chris Quinn14-Oct-15 2:30
Chris Quinn14-Oct-15 2:30 
GeneralRe: Get check time from separate fields in Microsoft SQL Server Pin
Richard Deeming14-Oct-15 2:47
mveRichard Deeming14-Oct-15 2:47 
GeneralRe: Get check time from separate fields in Microsoft SQL Server Pin
Chris Quinn14-Oct-15 2:50
Chris Quinn14-Oct-15 2:50 
QuestionInsert within Select Statement Pin
indian14313-Oct-15 7:50
indian14313-Oct-15 7:50 
AnswerRe: Insert within Select Statement Pin
Richard Deeming13-Oct-15 8:43
mveRichard Deeming13-Oct-15 8:43 
GeneralRe: Insert within Select Statement Pin
indian14313-Oct-15 8:58
indian14313-Oct-15 8:58 
GeneralRe: Insert within Select Statement Pin
indian14313-Oct-15 10:28
indian14313-Oct-15 10:28 
AnswerRe: Insert within Select Statement Pin
Mycroft Holmes13-Oct-15 22:55
professionalMycroft Holmes13-Oct-15 22:55 
QuestionSort GetChildRow datarow array Pin
BobW99912-Oct-15 2:58
BobW99912-Oct-15 2:58 
AnswerRe: Sort GetChildRow datarow array Pin
Mycroft Holmes12-Oct-15 13:07
professionalMycroft Holmes12-Oct-15 13:07 
GeneralRe: Sort GetChildRow datarow array Pin
BobW99912-Oct-15 17:34
BobW99912-Oct-15 17:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.