distinct

LINQ Select Distinct while ignoring the XML field

Hello, I have a complex LINQ query (using LINQ 2 EF) that can return duplicate results and I'm thus using the .Distinct() method to avoid duplicates. Here's the skeleton: var subQuery1 = // one query... var subQuery2 = // another query... var result = subQuery1.Distinct().Union( subQuery2.Distinct() ).ToArray(); Each of the sub que...

SQL distinct or group by

My brain aint functioning atm.. Can you pls help me out here: Got a table with date, analyseid, groupid I want to get unique groupid's.. perhaps with a count on same groupid's. Also if there are rows with same groupid the date is also the same. SELECT date, analyseid, COUNT(*) AS 'amount', groupid FROM myTable GROUP BY gr...

LINQ: Select from IEnumerable with Distinct/GroupBy and sorting - possible?

My particular example is fairly complex but I think the concept would apply equally to something like a logging system so I'll use that instead for ease of explanation. It's a ficticious example, please don't harp on or agonise over what is achitectually, programatically or morally wrong with the example itself :) Say you have this: cl...

XSLT copying without xsl:copy-of

I've got some *.xml with elements like : <app-method name="leave-accrual-status-details" kind="enquiry"> <title>...</title> <required-roles> <role name="authenticated"/> </required-roles> <asd> <param name="..." datatype="dt:int" control="hidden" call-kind="..." data-kind="..."/> </asd> <data-engine s...

MYSQL user statistics query help?

I have a table (statistics) with the columns User, Date (datetime), Page and IP. I have this query: SELECT * FROM statistics WHERE page LIKE '%page_name' ORDER BY date DESC LIMIT 30. That's ok to display all the user that visited that page. But I would like to display unique ips per day, something like DISTINCT ip (per day) I don't k...

Count multiple appearances in DISTINCT statement with two parameters?

Dear all, I am trying to filter (or count) companies with multiple contact persons from a table containing a company_id and a person_id. Currently I just do this: SELECT DISTINCT company_id,person_id FROM mytable GROUP BY company_id ORDER BY company_id as well as SELECT DISTINCT company_id FROM mytable The first query returns a co...

Count changes of a value over time?

Hi all, again I am stuck with counting something in MySQL. The database structure is far from SOers´d call optimal, but nevertheless I do not have an influence here and have to live with it. Probably that´s one of the reasons why I need help again to get some information out of it :) Assume I have: some_id (not the PK of the table, n...

Looking to group specific items from a list based on names using linq, html helper related

Hi, I have a list of items I am retrieving which i wish to be grouped into divs depending on the common name that a set of the list items may have say for instance a list of firstnames I have. i would like to be able to create a div dynamically based on the items common attibutes. id 23 fistname darren id 37 fistname darren id 67 ...