Click here to Skip to main content
15,892,059 members
Home / Discussions / Database
   

Database

 
GeneralRe: How to use the Case in stored procedure Pin
Mycroft Holmes14-Nov-09 1:59
professionalMycroft Holmes14-Nov-09 1:59 
GeneralRe: How to use the Case in stored procedure Pin
Andy_L_J14-Nov-09 2:38
Andy_L_J14-Nov-09 2:38 
AnswerRe: How to use the Case in stored procedure Pin
Niladri_Biswas14-Nov-09 17:56
Niladri_Biswas14-Nov-09 17:56 
QuestionCreating Records based on Quant Field Pin
ffowler12-Nov-09 7:57
ffowler12-Nov-09 7:57 
AnswerRe: Creating Records based on Quant Field Pin
Mycroft Holmes12-Nov-09 11:35
professionalMycroft Holmes12-Nov-09 11:35 
GeneralRe: Creating Records based on Quant Field Pin
David Skelly12-Nov-09 22:41
David Skelly12-Nov-09 22:41 
GeneralRe: Creating Records based on Quant Field Pin
Mycroft Holmes12-Nov-09 23:05
professionalMycroft Holmes12-Nov-09 23:05 
AnswerRe: Creating Records based on Quant Field Pin
Niladri_Biswas12-Nov-09 16:16
Niladri_Biswas12-Nov-09 16:16 
Are you looking for this

declare @tblCustomers table(CustID int,CustomerName varchar(50))
declare @tblWidgets table(CustID int,WidgetTypeID int, Qty int)
declare @tblTarget table(CustID int,WidgetTypeID int, Qty int)
insert into @tblCustomers values(101,'Cust1'),(102,'Cust2'),(103,'Cust3')
insert into @tblWidgets values(101,1,5),(101,2,1),(101,3,3),(102,10,5),(103,4,1)



--Program starts
insert into @tblTarget
select CustID,WidgetTypeID,Qty
from
(
	select w.CustID,w.WidgetTypeID,w.Qty from @tblWidgets w
	inner join @tblCustomers c
	on c.CustID = w.CustID
)X where X.CustID =101
select * from @tblTarget


The output being

CustID	WidgetTypeID	Qty
101	1	5
101	2	1
101	3	3

Smile | :)

Niladri Biswas

AnswerRe: Creating Records based on Quant Field Pin
David Skelly12-Nov-09 22:38
David Skelly12-Nov-09 22:38 
GeneralRe: Creating Records based on Quant Field Pin
David Skelly13-Nov-09 0:15
David Skelly13-Nov-09 0:15 
GeneralRe: Creating Records based on Quant Field Pin
ffowler13-Nov-09 1:50
ffowler13-Nov-09 1:50 
GeneralRe: Creating Records based on Quant Field Pin
David Skelly13-Nov-09 2:31
David Skelly13-Nov-09 2:31 
GeneralRe: Creating Records based on Quant Field Pin
ffowler13-Nov-09 2:50
ffowler13-Nov-09 2:50 
QuestionProblem with Datepart Pin
Vimalsoft(Pty) Ltd12-Nov-09 3:10
professionalVimalsoft(Pty) Ltd12-Nov-09 3:10 
AnswerRe: Problem with Datepart Pin
J4amieC12-Nov-09 3:52
J4amieC12-Nov-09 3:52 
AnswerRe: Problem with Datepart Pin
Not Active12-Nov-09 5:36
mentorNot Active12-Nov-09 5:36 
GeneralRe: Problem with Datepart Pin
David Skelly12-Nov-09 5:42
David Skelly12-Nov-09 5:42 
GeneralRe: Problem with Datepart Pin
Not Active12-Nov-09 5:44
mentorNot Active12-Nov-09 5:44 
AnswerRe: Problem with Datepart Pin
David Skelly12-Nov-09 5:42
David Skelly12-Nov-09 5:42 
GeneralRe: Problem with Datepart Pin
Vimalsoft(Pty) Ltd12-Nov-09 22:52
professionalVimalsoft(Pty) Ltd12-Nov-09 22:52 
QuestionChanging a column to IDENTITY Pin
garfield18511-Nov-09 22:34
garfield18511-Nov-09 22:34 
AnswerRe: Changing a column to IDENTITY Pin
Niladri_Biswas12-Nov-09 1:16
Niladri_Biswas12-Nov-09 1:16 
GeneralRe: Changing a column to IDENTITY Pin
garfield18512-Nov-09 2:41
garfield18512-Nov-09 2:41 
GeneralRe: Changing a column to IDENTITY Pin
WoutL12-Nov-09 3:05
WoutL12-Nov-09 3:05 
GeneralRe: Changing a column to IDENTITY Pin
Niladri_Biswas12-Nov-09 3:22
Niladri_Biswas12-Nov-09 3:22 

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.