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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Sql Queary with multiplication

Author  Topic 

hspatil31
Posting Yak Master

182 Posts

Posted - 2009-08-11 : 08:35:07
Dear All,

I am haveing following queary and output. Now in that queary can i give any outside parameter after that i will get Output2. I tried
select empno*2 from employee for that. But in that i want to give parameter that parameter will multiply this empno. And that parameter not related with table means that is outside parameter for only multiplication.

select empno from employee

Output1 :
1
2
3
4
5

Output2:
2
4
6
8
10

thnks
Harish Patil

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-08-11 : 08:37:02
declare @value int
select @value = 2

select empno * @value as empno from employee

if ur creating a sp then add input parameter as @value
Go to Top of Page

Nageswar9
Aged Yak Warrior

600 Posts

Posted - 2009-08-11 : 08:37:47
select empno,empno+empno from urtable
Go to Top of Page

hspatil31
Posting Yak Master

182 Posts

Posted - 2009-08-13 : 02:27:11
Hi,

You told me create parameter and geives the default parameter as 2.
But i want this in Crystal Report. So this parameter is not related to any table.My Queary is,
So in that insted of default value how to give the parameter.

select ot.Code,i1.Code,om.ItemName,i1.Quantity*(50) as Quantity, om.InvntryUOM From OITT As ot
Left Join ITT1 As i1
On i1.Father = ot.Code
Left Join OITM As om
On om.ItemCode = i1.Code
where ot.Code IN (select i1.Code from ORDR As o
Left Join RDR1 As r1
On r1.DocEntry = o.DocNum
Left Join ITT1 As i1
On i1.Father = r1.ItemCode
where o.DocNum = '51' and r1.ItemCode = 'JDET01' and i1.Code between'JD05'and 'jd15')
Go to Top of Page
   

- Advertisement -