Speaking of Filter and Match...

Roger Guay irog at mac.com
Mon Mar 14 18:31:59 EDT 2022


Ah, I see. Thank you again, Bob.

Roger

> On Mar 14, 2022, at 2:37 PM, Bob Sneidar via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> 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
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list