Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Take last entry in group-by SQL?
Message
From
05/12/2000 05:24:11
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
05/12/2000 03:21:17
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00449211
Message ID:
00449224
Views:
9
>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,

Justok,
There is something wrong here. Group by takes the last entry.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform