Topic: query

from an editbox i give the partnumber (EAN)

How can I get in one line the sum of a quantity from one part number when it is in many lines ?

When I use search it shows in the tablegrid the part number in many lines.

How to do that using Query ?

the following script  shows me all the partnumbers (EAN)  and not one from the editbox

select   EAN,
         sum(qty)
from     PinB   
group by EAN

Re: query

Hi,
You need to include the edit field as part of the SQLQuery search.
Take a look at the attachment.
Derek.

Post's attachments

Attachment icon pozidis.zip 440.67 kb, 21 downloads since 2026-07-08 

Re: query

It works.  Thank you.
Another question.
I have added also another edit box for the qty.
So I can also search except the wan also with the quantity.
What I did is added a edit box with the record name qty and added in the script you send 
When (ean like '%{edit7}%')  or  (ean like '%{edit8}')

But it doesn't work.
Ok I don't use SQL , us you understand..
What I wanna do is agetting results with combination of the two edit boxes or single one's

Re: query

Hi,
Try it like this (see attached).
In your example, you can't combine 'edit7' and 'edit8' in the same 'WHERE' filter because 'edit8' ((sum(qty)) hasn't yet been calculated (it is the result of the SQL Query itself).
You need to wait until the SQLQuery has finished and then use 'HAVING' instead of 'WHERE'
In other words, a 'WHERE' filter is applied when the SQLQuery runs and a 'HAVING' filter is applied AFTER the SQLQuery has finished.
I hope that makes sense.
Derek.

Post's attachments

Attachment icon pozidis EAN and QTY.zip 440.73 kb, 21 downloads since 2026-07-11