distinct

View of multiple tables. Need to remove “doubles” defined by 1 table

 ̄綄美尐妖づ 提交于 2019-12-11 02:53:10
问题 Ok, so this is what i'm stuck with. Full size SELECT dbo.InstellingGegevens.INST_SUBTYPE, dbo.InstellingGegevens.INST_BRON, dbo.InstellingGegevens.INST_INSTELLINGSNUMMER, dbo.InstellingGegevens.INST_NAAM, dbo.InstellingGegevens.INST_KORTENAAM, dbo.InstellingGegevens.INST_VESTIGINGSNAAM, dbo.InstellingGegevens.INST_ROEPNAAM, dbo.InstellingGegevens.INST_STATUUT, dbo.InstellingGegevens.ONDERWIJSNIVEAU_REF, dbo.InstellingGegevens.ONDERWIJSSOORT_REF, dbo.InstellingGegevens.DATUM_TOT, dbo

Sum and distinct dont alter results?

旧城冷巷雨未停 提交于 2019-12-11 02:36:15
问题 I am a novice trying to work through this here with no luck so far, any help is greatly appreciated!!! Select Distinct (AB.agency_no || '-' || ab.branch_no) AS "AGENCY-BRANCH", count (AB.agency_no || '-' || ab.branch_no) AS Occurences, A.AGY_NAME AS AGENCY, Sum(AB.annual_premium) as Premium From Agency_Book_View AB, Agency A, Branch B Where AB.agency_no = A.Agency_No AND B.EXPIRATION_DATE = TO_DATE('12-31-2078', 'MM-DD-YYYY') AND B.EFFECTIVE_DATE <= sysdate and b.effective_date >=sysdate -

Counting the rows of a column where the value of a different column is 1

二次信任 提交于 2019-12-11 02:29:41
问题 I am using a select count distinct to count the number of records in a column. However, I only want to count the records where the value of a different column is 1. So my table looks a bit like this: Name------Type abc---------1 def----------2 ghi----------2 jkl-----------1 mno--------1 and I want the query only to count abc, jkl and mno and thus return '3'. I wasn't able to do this with the CASE function, because this only seems to work with conditions in the same column. EDIT: Sorry, I

Get Distinct Parent Items using Lambda

跟風遠走 提交于 2019-12-11 02:27:36
问题 I have the following three classes; public class City { public int CityId { get; set; } public Region Region { get; set; } public string Name { get; set; } } public class Region { public int RegionId { get; set; } public Country Country { get; set; } public string Name { get; set; } } public class Country { public string CountryCode { get; set; } public string Name { get; set; } } I have populated a City List object to contain a number of cities, of which each have a Region and a Country. Now

XSLT: select distinct but slightly different to other examples

喜欢而已 提交于 2019-12-11 02:26:36
问题 I have the following XML: <a> <b> <d>D1 content (can include child nodes)</d> </b> <b> <c>C1 content (can include child nodes)</c> </b> <b> <e>E1 content (can include child nodes)</e> </b> <b> <c>C2 content (can include child nodes)</c> </b> </a> Using XSLT 1.0, I need to produce from this simply: "cde"; i.e. a distinct list of the names of the immediate children of /a/b/ ordered by the node name. Each b has exactly one child of arbitrary name. I can produce "ccde": <xsl:for-each select="/a/b

SQL Count. How can I count how many distinct values are in a table when an other two columns are matching?

China☆狼群 提交于 2019-12-11 02:04:59
问题 I am trying to complete an sql query to show how many GCSEs a student has on record.] *STUDENT *SUBJECT *SCHOOL ABB13778 | English | Social Care & Early Years ABB13778 | Information and Communication Technology | Social Care & Early Years ABB13778 | Mathematics | Social Care & Early Years ABB13778 | Media Studies | Social Care & Early Years For example this student should recieve a count of 4 as there is 4 distinct subjects assigned to the school and student ID. I can count the items but the

Tricky sql distinct with Sql Geometry field

不想你离开。 提交于 2019-12-11 01:41:13
问题 I have an sql statement that is not compatible with the Sql Geometry type so i am trying to revamp it to make it work. The basic gist of it is something like this: Select distinct A,B,C,D,SHAPE FROM TABLE1 UNION SELECT A,B,C,D,SHAPE FROM TABLE2 So the results of a complex distinct statement on two different (but similar) tables is unioned. The problem is that the SQL Geometry type (the SHAPE field) cannot be included in a distinct statement because it is not a comparable type. I'm okay with

Uniq of ruby array fails to work

此生再无相见时 提交于 2019-12-11 01:27:38
问题 I have a array of my object Country which has the attributes "code" and "name" The array could have a country in it more than once so I want to distinct the array. This is my countries class class Country include Mongoid::Fields::Serializable attr_accessor :name, :code FILTERS = ["Afghanistan","Brunei","Iran", "Kuwait", "Libya", "Saudi Arabia", "Sudan", "Yemen", "Britain (UK)", "Antarctica", "Bonaire Sint Eustatius & Saba", "British Indian Ocean Territory", "Cocos (Keeling) Islands", "St

Return column name and distinct values

喜你入骨 提交于 2019-12-11 01:15:03
问题 Say I have a simple table in postgres as the following: +--------+--------+----------+ | Car | Pet | Name | +--------+--------+----------+ | BMW | Dog | Sam | | Honda | Cat | Mary | | Toyota | Dog | Sam | | ... | ... | ... | I would like to run a sql query that could return the column name in the first column and unique values in the second column. For example: +--------+--------+ | Col | Vals | +--------+--------+ | Car | BMW | | Car | Toyota | | Car | Honda | | Pet | Dog | | Pet | Cat | |

Msql: Counting growth over time

…衆ロ難τιáo~ 提交于 2019-12-11 00:59:51
问题 I posted about this a few weeks ago, but I don't think I asked the question clearly because the answers I got were not what I was looking for. I think it's best to start again. I'm trying to query a database to retrieve the number of unique entries over time. The data looks something like this: Day | UserID 1 | A 1 | B 2 | B 3 | A 4 | B 4 | C 5 | D I'd like the query result to look this this Time Span | COUNT(DISTINCT UserID ) Day 1 to Day 1 | 2 Day 1 to Day 2 | 2 Day 1 to Day 3 | 2 Day 1 to