I've got two SQL Server tables authors, and articles where authors primary key (AuthorID) is a foreign key in the articles table to represent a simple one-to-many relationship between authors and articles table. Now here's the problem, I need to issue a full text search on the authors table based on the first name, last name, and biograp...
how do you return number of distinct/unique values in an array for example
int[] a = {1,2,2,4,5,5};
...
I am trying to get a list of distinct taxonomy terms in drupal using views2.
It seems it shouldnt be that big of a problem, however when i select the taxonomy:all terms, and select what vocabulary to limit to i get duplicates.
The "distinct" option in drupal does nothing, and i cant find anything else that groups it together.
If anyone k...
string[] arr = { "abcdefXXX872358", "abcdef200X8XXX58", "abcdef200X872359", "6T1XXXXXXXXXXXX11", "7AbcdeHA30XXX541", "7AbcdeHA30XXX691" };
how can I get distinct no from above where first 6 charatcer must be distinct
result would be
abcdefXXX872358
6T1XXXXXXXXXXXX11
7AbcdeHA30XXX541
I try something like this
var dist = (from c i...
I have a programme listing database with all the information needed for one programme packed into one table (I should have split programmes and episodes into their own) Now since there are multiple episodes for any given show I wish to display the main page with just the title names in ascending and chosen letter. Now I know how to do th...
I want to know can I use distinct in different columns when writing a SQL query. If so then what is the statement if I have employee table that has id,name, salary, addr as columns
...
I have a batch job that I run on a table which I'm sure I could write as a prepared statement. Currently it's all in Java and no doubt less efficient than it could be. For a table like so:
CREATE TABLE thing (
`tag` varchar,
`document` varchar,
`weight` float,
)
I want to create a new table that contains the top N entries for ev...
I'm doing a select in MySQL with an inner join:
SELECT DISTINCT tblcaritem.caritemid, tblcar.icarid
FROM tblcaritem
INNER JOIN tblprivatecar ON tblcaritem.partid = tblprivatecar.partid
INNER JOIN tblcar ON tblcaritem.carid = tblcar.carid
WHERE tblcaritem.userid=72;
Sometimes I get duplicates of tblcaritem.caritemid in the result. ...
I've seen a few different versions of this question but having difficulty applying it to what I need...
MS SQL Server 2008 query:
SELECT Receipts.ReceiptID, Receipts.UserID, Receipts.UserCardID, FolderLink.ReceiptFolderLinkID
FROM dbo.tbl_ReceiptFolderLnk AS FolderLink
INNER JOIN dbo.tbl_Receipt AS Receipts ON FolderLink.ReceiptID...
suppose I have two columns of integers, A and B. Now I want distinct values from these, meaning if both A and B have 1, I want 1 only once.
Note: I am NOT interested in getting distinct rows. I just want to get unique integer values from this table which could either be in A or B
I could insert values of A and B in one column of some...
Given the following code setup:
public class Foo {
List<string> MyStrings { get; set; }
}
List<Foo> foos = GetListOfFoosFromSomewhere();
How do I get a list of all of the distinct strings in MyStrings across all of the Foo instances using LINQ? I feel like this should be easy, but can't quite figure it out.
string[] distinctMyStrin...
Is it possible to shorten a group by clause so that you do not have to repeat the fields mentioned in the select clause ad nauseam? For example:
SELECT
field1,
field2,
field3,
field4
FROM table
GROUP BY
field1,
field2,
field3,
field4
to:
SELECT
field1,
field2,
field3,
field4
FROM table
GROUP BY
SELECT.*
...
Hi!
My entities look something like that (simplified):
public class Person
{
public Guid Id { get; set; }
public string Name { get; set; }
public IList<Department> Departments { get; set; }
}
public class Department
{
public Guid Id { get; set; }
public string Name { get; set; }
}
I'm querying the database throu...
I'd like to run a query which for a given field will count the instances of a particular character.
For example if I had a table called 'Friends' with a 'Names' field containing rows: Edward, James, Mike. I'd get the output:
A 2,
D 2,
E 3,
I 1,
and so on...
...
I have a table delivery_history which is populated by a trigger:
id(guid) order_number delivery_number haulier timestamp(getdate())
1 1234 haulier1 2009-10-08 8:34:00
2 1235 haulier1 2009-10-09 9:15:00
1 1234 haulier2 2009-...
Having tried and failed to modify the XSL from here: http://stackoverflow.com/questions/399204/xslt-distinct-elements-and-grouping
I'm posting here to ask if anyone could please help. I've basically got the same data structure (mine is actually an RSS feed of products) as in the above post, but I want to list the Description elements un...
I have a table user_quotes with the fields quotes_id, quotes_user, quotes_desc, quotes_date, quotes_status, quotes_location. In this quotes_user allows duplication entries. when i execute my query i am trying to avoid duplication entries of quotes_user. so I executed the query like this,
select distinct quotes_user from user_quotes;
...
I've got the following classes:
public class SupplierCategory : IEquatable<SupplierCategory>
{
public string Name { get; set; }
public string Parent { get; set; }
#region IEquatable<SupplierCategory> Members
public bool Equals(SupplierCategory other)
{
return this.Name == other.Name && this.Parent == other....
I need to select distinct rows from Textfile display below.
TextFile
123| one| two| three <br/>
124| one| two| four <br/>
125| one |two| three <br/>
Output should like this
123| one| two| three <br/>
124| one| two| four <br/>
OR
124| one| two| four <br/>
125| one |two| three <br/>
I am using this code to work out this ...
I'm trying to get distinct id's out of a 6 million row table. The query is pretty simple, and the explain seems ok. The distict row is indexed as part of a grouped index of uid-date-time.
The query is
SELECT DISTINCT uid FROM events;
and returns 334117 rows in 17 min 15.54 seconds.
The explain is
+----+-------------+-------------...