SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Sum Functions returns Twice?..
 New Topic  Reply to Topic
 Printer Friendly
Previous Page
Author Previous Topic Topic Next Topic
Page: of 3

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 02/14/2013 :  23:27:59  Show Profile  Reply with Quote
i think what you should do is to remove the preceding 0s from prodcode field to make values match. then apply the logic and you should get the intended results

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

adbasanta
Posting Yak Master

120 Posts

Posted - 02/15/2013 :  00:19:01  Show Profile  Reply with Quote
thank you visakh16!

Is it possible to execute a query in PO_detail that will select only those prodcode whos starts with zero for easy edit?

thank you!

-------------------------------------------------------------------------------------------------------
Learning MS SQL Server 2008

Edited by - adbasanta on 02/15/2013 00:19:39
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 02/15/2013 :  00:28:40  Show Profile  Reply with Quote

SELECT prodcode
FROM  PO_detail
WHERE prodcode LIKE '0%'


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

adbasanta
Posting Yak Master

120 Posts

Posted - 02/15/2013 :  00:32:13  Show Profile  Reply with Quote
Thank you visakh16!

this query i think should select all prodcode that starts with zero too.

select from PO_detail
where SUBSTRING(prodcode,1,1)=0
order by itemname asc


thank you!
-------------------------------------------------------------------------------------------------------
Learning MS SQL Server 2008

Edited by - adbasanta on 02/15/2013 00:33:26
Go to Top of Page

adbasanta
Posting Yak Master

120 Posts

Posted - 02/15/2013 :  01:49:51  Show Profile  Reply with Quote
Thank you visakh16, TG, James K!

Now its working correctly!

-------------------------------------------------------------------------------------------------------
Learning MS SQL Server 2008
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 02/15/2013 :  02:28:16  Show Profile  Reply with Quote
quote:
Originally posted by adbasanta

Thank you visakh16!

this query i think should select all prodcode that starts with zero too.

select from PO_detail
where SUBSTRING(prodcode,1,1)=0
order by itemname asc


thank you!
-------------------------------------------------------------------------------------------------------
Learning MS SQL Server 2008


that what suggestion i gave will do too

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
Page: of 3 Previous Topic Topic Next Topic  
Previous Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000