In fact if you are using mysql you could even do this:
Code:
select
coalesce(gp/sales,0) as gp_percent
from yourtable
the coalesce says that if your result would be null then just show 0 in the gp_percent output.
-- This message may have been cut off and the rest will only be shown to members. To become a member, click here --