Declare @a Decimal;
Declare @b Decimal;
Set @a = 100*(Select price From prices Where prodid = 'a4');
Set @b = 100+(Select cgst from taxes where prodid = 'a4')+(Select sgst from taxes where prodid = 'a4')+(Select cess from taxes where prodid = 'a4')
SELECT
Round(@a/@b,2) as 'Price per Crtn(excl Taxes)',
t.cgst+'%' as 'CGST(%)',
t.cgst*ROUND(@a*0.01/@b,2) as 'CGST Per Crtn',
t.sgst+'%' as 'SGST(%)',
t.sgst*ROUND(@a*0.01/@b,2) as 'SGST Per Crtn',
t.cess+'%' as 'CESS(%)',t.cess*ROUND(@a*0.01/@b,2) as 'CESS Per Crtn',
r.price as 'Price per Crtn(incl Taxes)',
'11' as 'Quantity',
'11'*ROUND(@a/@b,2) as 'Total Price(excl Taxes)',
Round(r.price*'11',2) as 'Total Price(incl Taxes)'
FROM
products p
JOIN
prices r ON (r.prodid = p.prodid)
JOIN
taxes t ON (t.prodid = r.prodid)
WHERE
p.prodid = 'a4'
请帮我解决此错误,因为我正在尝试在DataGridview中填充上述查询的输出
答案 0 :(得分:0)
谢谢@Lamak和@Raska 我找到了答案
CAST(t.cgst AS varchar)+'%'