sql - Store the result of a JOIN query in a variable -



sql - Store the result of a JOIN query in a variable -

looks off reply next question: a.how many sales orders (headers) used colonialview credit cards between june 2004 , (end of)june 2006. b.store output in variable.

the output select @salesorders 1 . should 1 or should same number of colonial voice cards used (which 729)?

this code

select b.cardtype, count(*) usdcv sales-salesorderheader bring together sales-creditcard b on a-creditcardid=b-creditcardid b-cardtype = 'colonialvoice' , a-orderdate between '06/1/2004' , '06/30/2006' grouping b.cardtype declare @salesorders int set @salesorders = count (*) select @salesorders

you should seek doing like

declare @salesorders int; select @salesorders = count(*) sales.salesorderheader bring together sales.creditcard b on a.creditcardid=b.creditcardid b.cardtype = 'colonialvoice' , a.orderdate between '06/1/2004' , '06/30/2006';

sql variables join

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -