Skip to Content
0
Former Member
Aug 01, 2008 at 03:14 PM

Help with SQL Query CRystal

13 Views

Dear all,

I am having weird problem with this query. I have two optional parameters set on the report and One parameter for Date Range.

Optional are One is Account number and other is Product Group (Stock Code).

When I skip both parameters (account number and product group) the report shows 0 records.

I found out that the SQL query is showing Stock_Code=" at the end of the query.

I am not sure why it is coming up there.

Here is the query

 SELECT order_header.order_no, order_header.order_status,
order_header.date_entered, order_header.act_despatch,
ndmas.ndm_name, order_lines.stock_code,
order_header.account_no
FROM   maxmast.order_header order_header,
maxmast.order_lines order_lines, maxmast.ndmas ndmas,
maxmast.slcust slcust
WHERE  (order_header.order_no=order_lines.order_no) AND
(ndmas.ndm_ndcode=slcust.slm_custcode) AND
(order_header.account_no=slcust.slm_custcode) AND
(order_header.date_entered>={ts '2008-06-01 00:00:00'} AND
order_header.date_entered<={ts '2008-06-30 00:00:00'}) AND
order_lines.stock_code>=''

Can you see the last option after date range this weird thing is coming up.

How can I get rid of this

Please note: When I use the parameters only Account number and delete the Product Group parameter, the report runs fine.

Regards

Jehanzeb