Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
195
Dataset for Ultragrid only inlude 1 copy of dups?
posted

I am using about 12 different queries, including many joins, as the datasource for a single UltraGrid and it works great! But one new issue has come up.

There is a Client table many to many relationship with Categories. If I say

SELECT DISTINCT
                      Client.MainClientID, Client.ClientName, Client.ClientNumber, Client.CPA, Client.Staff, Client.OfficePhone, Client.CellPhone,
                      Client.HomePhone, Client.FaxNumber, Client.Email, Client.TIN, Client.Active
FROM         (Client INNER JOIN
                      CategoryClient ON Client.MainClientID = CategoryClient.CategoryClientID)
WHERE (CategoryClient.CategoryName = pCategoryName1 OR
                      CategoryClient.CategoryName = pCategoryName2)

Without DISTINCT, if the exact same client had both pCategory1 and pCategory2 (set at runtime) I would get dups of course and it would bomb since the grid really is bound to a straight Client table and expects unique ID's.

That works prefectly *but* give an OR result. Now he wants an AND result, but each returned record has only 1 category field, by definition.

So what I need is the *opposite* of DISTINCT.

**I want it to exclude ONLY records that are ARE duplicated in the results, but still only give me one instance of each of those.**

I can do this though code of course in an intermediate table, but he wants to do his own custom reports directly in Access.

I realize this is more a SQL question than a Infragistics question really, but the UltraGrid is the final display layer and I get better results with this forum than any other.

  • 9190
    Offline posted

    Hello,

    I understand that you are inquiring about how to properly generate an SQL query that provides you with the the opposite of DISTINCT, as mentioned in your statement. Because this issue doesn’t relate to our controls, I believe you will find it more helpful to look over the Transact-SQL resource information located in the MSDN page found below: http://msdn.microsoft.com/en-us/library/bb510741.aspx

    Please let me know if you have further questions regarding this matter.

    Sincerely,
    Jose
    Developer Support Engineer
    Infragistics, Inc.
    www.infragistics.com/support