Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Take last entry in group-by SQL?
Message
From
05/12/2000 03:21:17
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Take last entry in group-by SQL?
Miscellaneous
Thread ID:
00449211
Message ID:
00449211
Views:
57
There is a request on barcode import txt file handling.
The user need the # of Same item scanned and the last QTY value of scan.

Here is an example:
SCAN_NO        ITEM                        QTY            
F0004              CM-1234-T1-M            16
F0004              CM-6284-T1-M            8
F0004              CM-1234-T1-M            4
F0004              CM-3356-T1-M            24
F0004              CM-6284-T1-M            40
F0004              CM-1234-T1-M            12    <~ take last occur value, maybe neither MAX() or MIN()

Wanted Result:
SCAN_NO        ITEM                        QTY            SCANTIME
F0004              CM-1234-T1-M            12                     3
F0004              CM-3356-T1-M            24                     1
F0004              CM-6284-T1-M            40                     2
Previously, I use GROUP-BY SQL to SUM() the overall value.
Now, the user feel inconvience because they need to remember what the old QTY to input..

As it is a Barcode scanner, input and read linear, it is very hard to check out on hand.
So, they prefer NOT to remember QTY but take last input as FINAL confirmation value.

I can't code any, if Simple:

SELECT *, COUNT(ITEM) AS SCANTIME FROM ibarcode GROUP BY ITEM ...

it ONLY take the First Occur qty, NOT last!

What can I do?

THanks and regards,
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.
Next
Reply
Map
View

Click here to load this message in the networking platform