Ms Access Query to SQL Server - Distinctrow

DISTINCTROW equivalent in SQL Server

From reading the documentation on distinctrow, it looks like you want an exists clause or (for generally better performance) a join:

SELECT * FROM A
WHERE EXISTS(SELECT * FROM B WHERE B.a_id = A.a_id)

SELECT DISTINCT A.* FROM A
INNER JOIN B ON A.a_id = B.a_id
-- corrected, should be inner join here

MS-Access DISTINCTROW dosen't work anymore if linked tables a stored on SQL2008-Server

Let's stop talking about the syntax of a left-join in ms-access. Fact is that if the linked tables are views on sql-server 2000:

create view [companies] as
select * from [TabCompanies] where deleted = 0

and

create view [contacts] as
select * from [TabContcts] where deleted = 0

These views are ODBC-linked-tables in a ms-access 2003/2007 mdb.
The questions shows up in ms-access on a query like

select distinctrow [companies].* from [companies] left join [contacts] on [companies].com_uid = contacts.com_uid] where [contacts].[function] like 'C*'

(lets forget that alternative syntax and look on the result assuming that the left join works without an error or syntaxerror)

This DISTINCTROW is a ms-access feature and not know in sql-server and for my point of view the result is the same like DISTINCT but works also even if there are columns with datatype of images par example.

All together we expect by now the same like Catcall in his answer said "select * from companies" BUT IT IS NOT, why?

This is only an excerpt of the whole query and may be makes no sense for production but it shows the changed behaviour wehn sql2008 is connected.

What is the equivalent to Access' 'SELECT DISTINCTROW * FROM...' in SQLite?

SELECT DISTINCT * FROM table WHERE column = value ORDER BY column2;

Since there's only one table involved, DISTINCTROW acts like DISTINCT.

MS-Access SQL DISTINCT GROUP BY

This should work:

SELECT DISTINCT GroupNumber, FirstNames
FROM Example AS b

how to use distinct in ms access

Okay.Its working this way.

SELECT DISTINCT Task.Priority, Task.Subject, Task.Status, Task.DueDate, 
Task.Completed, Categories.Category
FROM Task, Categories
WHERE (((Categories.CategoryID)=[Task].[CategoryID]));


Related Topics



Leave a reply



Submit