Proper Reports in Dolibarr

Hi Aljawaid,
Since this is community where people contribute I will help you with your SQL queries. Hoping to make this beneficial for both of us, we mutually share stuff with each other. See below SQL queries. Hope it’s useful :happy:

LIST OF PRODUCTS WITHout TAGS AND CATEGORIES


SELECT DISTINCT
u.rowid AS Category_ID,
u.label AS Category_Label,
u.description AS Category_description,
p.rowid AS Product_ID,
p.ref AS Product_Code,
p.label as Product_Label
FROM
llx_categorie AS u
JOIN llx_categorie_product AS cp
ON
cp.fk_categorie = u.rowid
RIGHT JOIN llx_product AS p
ON
p.rowid = cp.fk_product
WHERE u.label is null
GROUP BY
p.rowid
ORDER BY
p.ref

ITEMS THAT HAVE BEEN IN STOCK FOR THE LAST 3 MONTHS
--------------------------------------------
SELECT DISTINCT rowid, ref, label, MONTHNAME(datec) as Month_Created, Monthname(tms) As Month_Modified, MONTHNAME(CONVERT(import_key, DATETIME)) as Month_Imported
FROM llx_product
WHERE tms >= (NOW()-INTERVAL 3 MONTH)
ORDER BY tms desc

1 Like