Issue with MySQL Query

Stimulsoft Reports.PHP discussion
Post Reply
plantant
Posts: 17
Joined: Sun Jan 30, 2011 8:40 pm
Location: NY, USA

Issue with MySQL Query

Post by plantant »

Hi, I am using the following query in "Edit Data Source" to bring data into Report.fx:

SELECT DISTINCT suppliers.supplier_id, plants.plant_id as pid, scientific_name, inventory.inventory_id as iid, container_desc, containersizes.order,
case (inventory.inventory_price mod 1 > 0)
when true then FORMAT(inventory.inventory_price, 2)
else inventory.inventory_price
end AS inventory_price,
ABS(IF(inventory.inventory_price = 0, 999999, inventory.inventory_price)) as sortorder,

FROM plants
JOIN inventory
ON inventory.plant_id = plants.plant_id
JOIN suppliers
ON suppliers.supplier_id = inventory.supplier_id
JOIN containersizes
ON containersizes.containersize_id = inventory.containersize_id
JOIN priceunits
ON priceunits.priceunit_id = inventory.priceunit_id

WHERE suppliers.supplier_id = {supplier}
AND inventory.inventory_active = 1
AND inventory.deleted = 0
ORDER BY scientific_name ASC, containersizes.order ASC, sortorder ASC

--------
The problem here:
WHERE suppliers.supplier_id = {supplier}
AND inventory.inventory_active = 1
AND inventory.deleted = 0 <------------ WHEN I HAVE TWO "AND" CONDITIONS, THE DATA DOES NOT SORT PROPERLY IN THE REPORT
ORDER BY scientific_name ASC, containersizes.order ASC, sortorder ASC

If I remove either one of the "AND" conditions, the report sorts properly. Can you please give some help. The query works fine when run in Phpmyadmin.

Thanks,
Darryl
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Issue with MySQL Query

Post by HighAley »

Hello.

Could you provide us a report template with sample data which reproduces the issue.

Thank you.
Post Reply