ODBC & DISTINCT

  • Thread starter Thread starter Terry
  • Start date Start date
T

Terry

I am connecting to a a table using ODBC and running a query that returns the
values from one field. There are duplicate values which normally I would use
the DISTINCT keyword in the SQL, however it's use causes 'Column not found'
to be returned. The query returns records without DISTINCT. Is there any
way I can return unique values?
Regards
 
DISTINCT works for me with an ODBC-linked SQL Server table ...

SELECT DISTINCT dbo_tblSalAccounts.[cl::alpha] AS DontAsk FROM
dbo_tblSalAccounts

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Thanks Brendan,
I think it's the ODBC provider for Sage that I'm using that is the problem.
regards


Brendan Reynolds said:
DISTINCT works for me with an ODBC-linked SQL Server table ...

SELECT DISTINCT dbo_tblSalAccounts.[cl::alpha] AS DontAsk FROM
dbo_tblSalAccounts

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


Terry said:
I am connecting to a a table using ODBC and running a query that returns
the values from one field. There are duplicate values which normally I
would use the DISTINCT keyword in the SQL, however it's use causes 'Column
not found' to be returned. The query returns records without DISTINCT. Is
there any way I can return unique values?
Regards
 
If you can't use DISTINCT, can you use GROUP BY?

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


Terry said:
Thanks Brendan,
I think it's the ODBC provider for Sage that I'm using that is the
problem.
regards


Brendan Reynolds said:
DISTINCT works for me with an ODBC-linked SQL Server table ...

SELECT DISTINCT dbo_tblSalAccounts.[cl::alpha] AS DontAsk FROM
dbo_tblSalAccounts

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible
for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


Terry said:
I am connecting to a a table using ODBC and running a query that returns
the values from one field. There are duplicate values which normally I
would use the DISTINCT keyword in the SQL, however it's use causes
'Column not found' to be returned. The query returns records without
DISTINCT. Is there any way I can return unique values?
Regards
 
Thanks Brendan,
Spot on result. I would never have thought of doing it that way as I'm not
summing anything.
Regards


Brendan Reynolds said:
If you can't use DISTINCT, can you use GROUP BY?

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


Terry said:
Thanks Brendan,
I think it's the ODBC provider for Sage that I'm using that is the
problem.
regards


Brendan Reynolds said:
DISTINCT works for me with an ODBC-linked SQL Server table ...

SELECT DISTINCT dbo_tblSalAccounts.[cl::alpha] AS DontAsk FROM
dbo_tblSalAccounts

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible
for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted
without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


I am connecting to a a table using ODBC and running a query that returns
the values from one field. There are duplicate values which normally I
would use the DISTINCT keyword in the SQL, however it's use causes
'Column not found' to be returned. The query returns records without
DISTINCT. Is there any way I can return unique values?
Regards
 
Back
Top