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@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to