Simple SQL Question

dlr at futurechalk.com dlr at futurechalk.com
Thu Oct 27 21:23:07 UTC 2022


Hello Das,

This should work

Select cc_seq,cc_credit_num,cc_token from cust_cc where cc_seq=(select max(cc_seq) from cust_cc where cc_current=1)

Dan

> On Oct 26, 2022, at 12:44 PM, Das Goravani <goravanis at gmail.com> wrote:
> 
> 
> I have tried to look this up, scoured others existing code, to no avail
> 
> How do you 
> 
> Select the highest Primary Key value
> With a couple other columns
> Where it’s for a certain customer, and "current" is true
> 
> I have this so far:
> 
> SELECT max(CC_SEQ),CC_CREDIT_NUM,CC_TOKEN 
> FROM cust_cc 
> WHERE CC_CCODE=@[iRowCust.CCODE] 
> AND CC_CURRENT=1
> 
> It’s not working, doing it in an exec direct using the statement object
> 
> It’s returning no rows when I know there is one that matches
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 



More information about the omnisdev-en mailing list