>> Clear as mud?
Totally.
Do you want a RANDOM value from each table, or one that appears only once?
SELECT MyField, COUNT(MyField) AS TheCounter FROM MyTable WHERE {blah blah
blah}
GROUP BY MyField HAVING TheCounter =1
will return a set of rows having a single UNIQUE value in MyField.
On Wed, Dec 19, 2012 at 8:48 PM, Vincent Teachout <[email protected]>wrote:
> Hello,
>
> Does anyone know of a way to select a unique value from an MSSQL table?
>
> For example: Select My_unique, * from sometable
>
> I don't care if it's numeric or string, as long as it's unique and generic.
>
> I need it to be very "vague" as in the above example, so I can iterate
> through a list of tables and get all of the values from the table plus a
> UID, without having to specify anything specific.
>
> For example, I can't use RowNum() OVER..... because then I have to specify
> the sort order for the table, using a specific field name.
>
> Clear as mud? any suggestions?
>
> ______________________________**_________________
> Post Messages to: [email protected]
> Subscription Maintenance:
> http://mail.leafe.com/mailman/**listinfo/profox<http://mail.leafe.com/mailman/listinfo/profox>
> OT-free version of this list: http://mail.leafe.com/mailman/**
> listinfo/profoxtech <http://mail.leafe.com/mailman/listinfo/profoxtech>
> Searchable Archive:
> http://leafe.com/archives/**search/profox<http://leafe.com/archives/search/profox>
> This message: http://leafe.com/archives/**byMID/profox/50D26E7D.3030808@**
> taconic.net<http://leafe.com/archives/byMID/profox/[email protected]>
> ** All postings, unless explicitly stated otherwise, are the opinions of
> the author, and do not constitute legal or medical advice. This statement
> is added to the messages for those lawyers who are too stupid to see the
> obvious.
>
> Report [OT] Abuse: http://leafe.com/reportAbuse/**
> [email protected]<http://leafe.com/reportAbuse/[email protected]>
>
--
Ted Roche
Ted Roche & Associates, LLC
http://www.tedroche.com
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/CACW6n4uGu_zNi=4vsn_hw5y4zp6ap0yhinzgma8+jfbdr+a...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.