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
 where clause

Author  Topic 

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2009-05-28 : 04:09:47
i need to take select query from my table assume TableA,in that
other columns including customer_code but i dont have customer name.

2)the use can give either of the input value or even none

3)iam having customer master table in which customer code and name
is maintained

my sample procedure is:
CREATE procedure invoice_adjustment_sp_new
(
@From_cust_code varchar(30),
@To_Cust_code varchar(30),
@From_cust_name varchar(50),
@To_cust_name varchar(50)
)
BEGIN
set nocount on

select * from Table A
where ?




set nocount off
END

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-05-28 : 04:11:51
just a simple INNER JOIN to the Customer Master table will do the job


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2009-05-28 : 04:51:17
quote:
Originally posted by khtan

just a simple INNER JOIN to the Customer Master table will do the job


KH
[spoiler]Time is always against us[/spoiler]





select A.*,B.customer_name
from TableA as A with (nolock) and customer_master B(nolock)
on a.cust_code=b.cust_code
where a.cust_code between @from_cus and @to_custom
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-05-28 : 05:50:17
[code]
select A.*,B.customer_name
from TableA as A with (nolock) and INNER JOIN customer_master B(nolock)
on a.cust_code=b.cust_code
where a.cust_code between @from_cus and @to_custom
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -