Speaking of Filter and Match...

Bob Sneidar bobsneidar at iotecdigital.com
Mon Mar 14 17:37:34 EDT 2022

The UNIQUE clause is the UNIQUE combination of ALL the columns put together. If I used: 

SELECT city,state UNIQUE FROM zip codes where state = 'CA' 

I would get every unique city/state combination in CA, whereas if I used: 

SELECT state UNIQUE from zip codes where state = 'CA'

I would get the first record matching 'CA', that is one record. 

There is a way to get the city and state for the one record (why anyone would want to I don't know) by creating a join to the same table and using the UNIQUE clause in the join. I am not that good at join syntax, so I won't attempt it here and embarrass myself. :-)

BTW you can get the last matching record by doing an ascending sort and using LIMIT 1, but I think MS SQL suffers from not having a limit clause. Not sure why. Instead you use the TOP clause. 

Bob S

> On Mar 14, 2022, at 12:14 , Roger Guay via use-livecode <use-livecode at lists.runrev.com> wrote:
>> Actually I must correct myself. That will not work because the unique value column (typically an autoincrementing integer) will not be unique for each record. Instead, assuming your lines of text are in a column called "textdata" 
>> SELECT textdata UNIQUE FROM...
>> Bob S

More information about the use-livecode mailing list