Hi
I'm very new to XQuery so excuse me if I am somehow missing something.
I am trying to extract data where certain sub-nodes of an element are DISTINCT, as well as where a certain sibling node's is equal to some predefined string
for $product in fn:distinct-values(document('cpwdoc')/root/package/properties/value[@key="product"])
wher...
When I use the following code I get the same items multiple times.
XElement neededFiles = new XElement("needed",
from o in _9nFiles.Elements()
join t in addedToSitePull.Elements()
on o.Value equals
t.Value
where o.Value == t.Value
select new XElement("pic", o.Value));
I'd like to get only unique items...
I have a sample database like this, in which, id is always unique, but the user_id is not unique.
id,user_id,message,msg_datetime
111,u1, msg from u1,time present here
112,u2, msg from u2,time present here
113,u3, msg from u3,time present here
114,u2, msg from u2,time present here
115,u7, msg from u7,time present here
116,u2, msg from u...
I HAVE THE FOLLOWING TABLE, I WOULD LIKE TO GET to do a select distinct on the the column [code], i don't need to get the "A" three times.
[ ID ] [ CODE ] [ LIBELLE ]
1 A LIBELLE1
2 B LIBELLE2
3 C LIBELLE3
4 A LIBELLE4
5 A LIBELLE5
6 D LI...
Query
SELECT
ppc.personid,
ppc.category,
ppc.phonenumber,
ppc.createts
FROM
person_phone_contacts ppc
WHERE
CURRENT_TIMESTAMP BETWEEN ppc.createts AND ppc.endts
AND CURRENT_DATE BETWEEN ppc.effectivedate AND ppc.enddate
ORDER BY
ppc.personid, ppc.category, ppc.createts DESC
Resulting Data
3742 | Home | xxx-xxx...
Hello
I have a sql table:
2.8.7
2.8.3
2.8.2
2.8.7
2.8.5
2.8.7
2.8.7
2.8.5
2.6.0
2.8.3
2.6.4
2.6.3
2.8.4
2.8.0
2.6.3
2.8.5
2.8.5
2.8.5
2.6.0
2.8.2
How do I bring a unique value version sorted by the number of these versions?
At the exit I want to get the following:
2.8.5 5
2.8.7 4
2.6.0 2
2.6.3 2
2.8.2 2
2.8....
Hi all,
I'm having trouble with an ExpandableListView. What I want is for each group to be from column "bond", which is non-unique, but I want the groups to be unique (i.e. each value of "bond" should only have one group). Each value in the group has data in other columns which should be displayed. The problem is that it seems I can eit...
I have a table called categories that has 3 columns: id, name, parent_id.
ID name group_id
== == ==
1 haim 1
2 gil 2
3 alon 1
4 idan 1
5 shai 3
6 adi 2
7 itay 3
8 aviram ...
Hi!
I have a table with 3 different IDs. I want to distinct on column 1 and 2 and summarize the values of column 3 (into one field - maybe comma separated string). The summarized field doesn't have to "look nice" (no problems with: '4,3,' (comma at the end)).
I'm using MS SQL Server 2008.
E.g:
ID1 ID2 ID3
1 1 5
1 1 8
...
I want do like this, but for another case that not function.
This is my example table:
Date Model No Line Range Lot Status
2010-08-01 KD-G435 1 01 1-100 013A accept
2010-08-01 KD-G435 2 01 1-100 013A accept
2010-08-01 KW-TC800 ...
I've been running into the following case repeatedly lately, either I need to apply MAX() or SUM() to one column on a table, but I need DISTINCT sets of values for other columns.
For example consider the following table and associated columns representing details of a login to StackOverflow.
SoUserLogins (OpenIdToken, Name, IpAdress, L...
Using PHP and MySQL I'm trying to get all the distinct values out the number and type columns from all 4 of the tables listed below:
table_1
ID|t1_number|t1_type
1|1|new
2|1|old
3|2|new
4|3|new
5|1|old
table_2
ID|t2_number|t2_type
1|1|future
2|1|new
3|3|past
4|3|new
5|1|new
table_3
ID|t3_number|t3_type
1|1|past
2|1|new
3|1|new
4|1|...
I have a mysql problem. I have two tables like this that I need to join together.
table:
id otherid2
1 | 1
2 | 1
3 | 2
4 | 2
table2:
otherid otherid2
1 | 1
2 | 1
3 | 2
4 | 2
I'm using:
SELECT id,otherid FROM table INNER JOIN table2 ON table.otherid2=table2.otherid2
Th...
I have a searchlogic that searches for not_null on an association that can occur many times, but I only want to display one UNIQUE/DISTINCT instance of the object:
Company.contact_emails_id_not_null
I only want one Company, no matter how many contact_emails are associated to that Company :through => :contacts
...
I have a SQL statement that I can use to return distinct rows from my Android sqlite3 database and I would like to pass it through the ContentProvider's query.
For example:
select lastName from peopleTable where upper(lastName) like upper("%smith%");
needs to be
select DISTINCT lastName from peopleTable where upper(lastName) like up...
I am trying to write a query in Postgresql that pulls a set of ordered data and filters it by a distinct field. I also need to pull several other fields from the same table row, but they need to be left out of the distinct evaluation. example:
SELECT DISTINCT(user_id) user_id,
created_at
FROM creations
ORDER BY crea...
Both of these work individually
SELECT PONumber,
count(RequestNumber) as "InNumOfRequests",
sum(Amount) as "SumofAmounts"
FROM tableView
GROUP BY PONumber
SELECT DISTINCT PONumber,
(10 * ceiling((DATEDIFF(day,POApprovedDate,GETDATE()))/10))
AS "BINofDaysSincePOApproved" ...
I have a table called "r", inside that table I store id, ip, and country. I am running this query:
SELECT r.country, count(rr.ip), count(DISTINCT rr.ip)
FROM `r`
LEFT JOIN r rr
ON r.country = rr.country
GROUP BY r.country
I do get rows with columns: "country";"number";"number";
But both "counts()" doesn not show what I want it to...
Hi
I'm sure there's query for this kind of operation, but I just can't seem to get it.
I have a table like this:
product_id | saved_by | deleted_by | accepted_by | published_by
-----------+----------+------------+-------------+-------------
1 | user1 | | user1 |
-----------+----------+------------+---------...
hy there!
given:
| name
-+---------------------------
| Josef Knoller
| Josef Somos
| KFZ Wiesauer
wanted result:
JOSEFKNMLRZWIAU
(case in the result does not matter - it was just easier holding the UPPER key while writing)
is there any way to do this in mssql?
thanks in advance!
EDIT
sorry ... i've mixed column and row ......