有没有人遇到一个解决方案来获得使用MySQL的SSRS的提示,我需要的提示是一个unix timpstamp。 SQL如下:
SELECT DISTINCT Concat(o.order_no, '-', o.order_no_iteration)
AS `order_no`
,
o.customer_order_no,
IF(o.on_hold = '1', 'Hold', CASE o.status
WHEN 'D' THEN 'Draft'
WHEN 'P' THEN 'Pending'
WHEN 'R' THEN 'Rejected'
WHEN 'A' THEN 'Approved'
WHEN 'E' THEN 'Pending [EDI]'
WHEN 'W' THEN 'Pending iWorld Approval'
WHEN 'I' THEN 'Pending Interface Approval'
WHEN 'C' THEN 'Cancelled'
end)
AS `order_status`,
IF(j.status IS NULL
OR j.status = ''
OR o.status = 'P', 'No worksheet', CASE j.status
WHEN 'I' THEN 'Incomplete'
WHEN 'C' THEN 'Complete'
end)
AS `jobsheet_status`,
p.property_name_number,
p.property_address1,
p.property_town,
p.property_postcode,
og.organisation_name,
b.name,
Concat('PO-', po.purchase_order_no)
AS `purchase_order_no`,
s.suppliers_name,
po.delivery_status,
po.supplier_invoice_ref,
IF(o.provisional_date != '', Date_format(
From_unixtime(o.provisional_date),
'%d/%m/%Y %H:%i'), '')
AS `provisional_date`,
IF(po.dateadded != '', Date_format(From_unixtime(po.dateadded),
'%d/%m/%Y %H:%i'
), '')
AS `date_added`,
IF(o.estimated_completion_date != '',
Date_format(
From_unixtime(o.estimated_completion_date), '%d/%m/%Y %H:%i'),
'') AS
`estimated_completion_date`,
IF(j.actual_completion_date_set != '',
Date_format(j.actual_completion_date_set,
'%d/%m/%Y %H:%i'), '') AS
`system_completion_date`,
o.total_value_budget,
Sum(pod.total),
o.total_value_budget - Sum(pod.total)
AS `margin`
FROM purchase_orders po
LEFT JOIN purchase_order_main_details pod
ON pod.purchase_order_id = po.purchase_order_id
LEFT JOIN main_detail md
ON pod.main_detail_id = md.main_detail_id
LEFT JOIN orders o
ON md.order_id = o.order_id
LEFT JOIN jobsheet j
ON j.group_id = o.order_id
LEFT JOIN properties p
ON p.property_id = md.property_id
INNER JOIN organisation og
ON o.client_id = og.organisation_id
INNER JOIN organisation_business_unit obu
ON obu.organisation_id = og.organisation_id
LEFT JOIN business_units b
ON b.business_unit_id = obu.business_unit_id
LEFT JOIN suppliers s
ON s.supplier_id = po.supplier_id
WHERE From_unixtime(po.dateadded, "%d/%m/%y") BETWEEN @d1 AND @d2
AND po.pad_no <> 'Automatic'
GROUP BY o.order_id,
customer_order_no,
purchase_order_no
ORDER BY purchase_order_no
我已尝试在表达式中将SSRS中的参数格式化为
=format(Parameters!d1.Value,"dd/mm/yy")
我还修改了sql使用:
where str_to_date(FROM_UNIXTIME(po.dateadded, "%d/%m/%Y"),'%d/%m/%Y')
between str_to_date(@d1,'%d/%m/%Y') and str_to_date(@d2,'%d/%m/%Y')
并没有奏效,尝试了各种不同的组合,但感到绝望
答案 0 :(得分:0)
尝试用
替换where子句 WHERE po.dateadded between UNIX_TIMESTAMP(STR_TO_DATE(@d1, "%d/%m/%y"))
AND UNIX_TIMESTAMP(STR_TO_DATE(@d2, "%d/%m/%y"))