Custom field in Query report

I’m trying to call a custom field in a query report, but I’m getting an error.

I have a field called damaged_bottles_qty in the stock entry and when I try and use it in a query report I get the following error.

30

MariDB doesn’t support syntax which you have applied in Query…

Please check at command line execution in MariaDB before apply in Query Report.

Can You share your query which can help others to help you out.

19

Try like this syntax.

Hi,

I’m sorry I can’t see this clearly. Where did I go wrong?

I was trying to follow this syntax:

https://frappeframework.com/docs/user/en/guides/reports-and-printing/how-to-make-query-report#2-set-the-query

hey @tefobw there is one mistake you have forgotten to add comma in the query so you query will be something like this
SELECT
tabStock Entry Detail.item_code AS ‘Item:Link/Item:150’,
tabStock Entry.damaged_bottles_qty AS ‘Damaged:Int:100’
FROM
tabStock Entry Detail,
tabStock Entry
WHERE
tabStock Entry.damages = 1

I have just amended single quote which is not available on the keyboard
    
SELECT
    `tabStock Entry Detail`.it`Preformatted text`em_code AS `Item:Link/Item:150`,
    `tabStock Entry`.damaged_bottles_qty AS `Damaged:Int:100`
    FROM
    `tabStock Entry Detail`,
    `tabStock Entry`
    WHERE
    `tabStock Entry`.damages = 1