distinct-values

How to count words frequency by removing non-letters of a string?

核能气质少年 提交于 2021-02-08 05:59:54
问题 I have a string: var text = @" I have a long string with a load of words, and it includes new lines and non-letter characters. I want to remove all of them and split this text to have one word per line, then I can count how many of each word exist." What is the best way to go about removing all non-letter characters, then splitting each word onto a new line so I can store and count how many of each word there are? var words = text.Split(' '); foreach(var word in words) { word.Trim(',','.','-'

how to select distinct values from two different tables

会有一股神秘感。 提交于 2020-11-29 19:20:20
问题 I have two tables like table1: id name posId Mid 1 sam 1 10 2 sid 1 10 3 jeet 1 10 table2: id name posid Mid 1 Anin 2 10 2 Nir 2 10 3 jeev 2 10 I want to have a table like... posid 1 2 ie; i want to have distinct "posid" by joining table1 and table2 where "Mid" will be same for table1 and table2 回答1: You can do something like this: select distinct t1.posId from t1 where not exists (select 1 from t2 where t2.posId = t1.posId) union all select distinct t2.posId from t2 where not exists (select

how to select distinct values from two different tables

落花浮王杯 提交于 2020-11-29 19:13:40
问题 I have two tables like table1: id name posId Mid 1 sam 1 10 2 sid 1 10 3 jeet 1 10 table2: id name posid Mid 1 Anin 2 10 2 Nir 2 10 3 jeev 2 10 I want to have a table like... posid 1 2 ie; i want to have distinct "posid" by joining table1 and table2 where "Mid" will be same for table1 and table2 回答1: You can do something like this: select distinct t1.posId from t1 where not exists (select 1 from t2 where t2.posId = t1.posId) union all select distinct t2.posId from t2 where not exists (select

XSLT 1.0 How to get distinct values

十年热恋 提交于 2020-03-23 14:32:32
问题 I had an XML somewhat similar to what is shown below. I had to find the unique categories. There are lot of easy ways in XSLT 2.0. But I had to stick to 1.0 :( . After several struggle I found the solution. I thought of sharing. Might help somebody. Please improve my answer. I appreciate. <root> <category> this is Games category </category> <category> this is Books category </category> <category> this is Food category </category> <category> this is Games category </category> <category> this

Distinct values in data bound combobox

╄→尐↘猪︶ㄣ 提交于 2020-02-21 04:11:43
问题 I have a table Inventory(ItemId,Name,Size,Price,otherinfo) where ItemId is primary key and Name,Size,Price are unique. When I bind the combobox with Name all repeated names appear while i want each name to appear just once, same happens with Size. How to load unique values in combobox which is bound to a datasource? 回答1: You can do this, (you may have to tweak it a bit to complie and work for you) ddlName.DataSource = items.Select(item=>item.Name).Distinct().ToList(); ddlName.DataBind();

Distinct values in data bound combobox

梦想与她 提交于 2020-02-21 04:10:15
问题 I have a table Inventory(ItemId,Name,Size,Price,otherinfo) where ItemId is primary key and Name,Size,Price are unique. When I bind the combobox with Name all repeated names appear while i want each name to appear just once, same happens with Size. How to load unique values in combobox which is bound to a datasource? 回答1: You can do this, (you may have to tweak it a bit to complie and work for you) ddlName.DataSource = items.Select(item=>item.Name).Distinct().ToList(); ddlName.DataBind();

Distinct values in data bound combobox

最后都变了- 提交于 2020-02-21 04:10:11
问题 I have a table Inventory(ItemId,Name,Size,Price,otherinfo) where ItemId is primary key and Name,Size,Price are unique. When I bind the combobox with Name all repeated names appear while i want each name to appear just once, same happens with Size. How to load unique values in combobox which is bound to a datasource? 回答1: You can do this, (you may have to tweak it a bit to complie and work for you) ddlName.DataSource = items.Select(item=>item.Name).Distinct().ToList(); ddlName.DataBind();

druid vs Elasticsearch

╄→гoц情女王★ 提交于 2020-01-02 04:43:12
问题 I'm new to druid. I've already read "druid VS Elasticsearch", but I still don't know what druid is good at. Below is my problem: I have a solr cluster with 70 nodes. I have a very big table in solr which has 1 billion rows, and each row has 100 fields. The user will use different combinations range query of fields (20 combinations at least in one query) to count the distinct number of customer id, but the solr's distinct count algorithm is very slow and uses a lot of memory, so if the query

MySQL get set of data with distinct values

ぐ巨炮叔叔 提交于 2019-12-25 08:16:37
问题 I have a simple problem; one which I thought would have a simple solution. Imagine a Table like this: Name Timestamp Data Bob 2011-01-01 01:00:00 Hi Alice 2011-02-02 02:00:00 Hello Alice 2011-03-03 03:00:00 Hello Bob 2011-04-04 04:00:00 Bye Charlie 2011-05-05 05:00:00 Cheese Charlie 2011-06-06 06:00:00 Toast All I want is to be able to run a query that shows the most recent entry for each Name. So with the above table, I would like an output like this: Name Timestamp Data Bob 2011-04-04 04:00

Counting distinct items in XSLT independent of depth

假装没事ソ 提交于 2019-12-24 10:37:57
问题 If I run the following XSLT code: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:key name="kValueByVal" match="variable_name/@value" use="."/> <xsl:template match="assessment"> <xsl:for-each select=" /*/*/variable/attributes/variable_name/@value [generate-id() = generate-id(key('kValueByVal', .)[1]) ] "> <xsl:value-of select= "concat(., ' ', count(key('kValueByVal', .)), ' ')"/> </xsl:for-each> </xsl:template> </xsl:stylesheet>