Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
Hi all,I have this sub-select query which aims to count all the "features" in a database of a certain type.What I want to do in this SQL is make it just the 2% of the total count (whatever that is as the number changes when new records are added).(SELECT count(*) FROM feat_attrib_type, feature WHERE feature.site_code = feat_attrib_type.site_code AND feature.plot_number = feat_attrib_type.plot_number AND feature.feature_deadflag <> 'Y' AND feat_attrib_type.attrib_type_code = 'GC' AND feat_attrib_type.attrib_value_code = '1') as CountAny ideas how I can calculate the 2% of this count and show it in the results?
webfred
Master Smack Fu Yak Hacker
8781 Posts
Posted - 2012-06-22 : 07:06:02
/100*2 as CountNo, you're never too old to Yak'n'Roll if you're too young to die.
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts
Posted - 2012-06-22 : 07:07:55
Multiply the COUNT(*) by 0.02. Or is there more to what you are asking?