Quantcast
Channel: Questions in topic: "distinct"
Browsing latest articles
Browse All 38 View Live

Not getting Distinct column as max date.

Can you see what is wrong with this query. or how to get only one Lookupid list I get multiple same lookup id in output. select V_CONSTITUENT.LOOKUPID , V_CONSTITUENT.NAME as ConstituentName ,...

View Article


Distinct count of values which are displayed in two columns in SSAS

Hi, How is it possible to get distinct count of two columns in fact table, meaning how many different appearances are in both columns. Please note I DO NOT mean distinct count on the concatenated...

View Article


select count

I need the count for tp.casenumber for the following result. any ideas? SELECT tp.CaseNumber, cast(tp.StartDate as date) as "Call Date",cast(tp.StartDate as time(0)) as "Call Time", cv_ct.CodeValue as...

View Article

Select distinct rows based on a column that have all possible values,Select...

Hi, I m trying to select distinct these rows that have all possible values of a given column. Please check the example bellow. - ID_REC ID_COMMAND ID_STORE - 1 100 1 - 2 110 1 - 3 120 1 - 4 100 2 - 5...

View Article

SQL SELECT Distinct Query question

I have a database table called Events that has the following columns: [Event_ID][Date_Time][Computer][User] I am trying to find the most recent [Date_Time] for each distinct [Computer] and [User]...

View Article


How to find the top 2 records for each unique id

I am looking to get the top two activity dates for each unique id in my query. when i select distinct it only brings the top two assuming i don't have a proper group by to get it done can anyone help??...

View Article

distinct and count for same table

Dear sir, i have table machine with colums id,mach_model. if query select count(mach_model) from machine where mach_model like '%etp%' rows effected are 200 for the same query if filter with '%ttp%'...

View Article

Using DISTINCT in 2 columns

I am new to this forum. I am trying to calculate distinct values of 2 columns from the same table. For example: id facility 1 seattle 2 kent 2 kent 1 seattle expected result: id facility 1 seattle 2...

View Article


Looking for Count of Field1 where Field2 is in High, Medium, or Low. Field 1...

I need a count of how many are HIGH, MEDIUM, LOW based on the following logic Looking at the highlighted examples: L14815 counts against high but not medium L14495 counts against Medium but not low...

View Article


sql for counting distinct values

I have one table with three columns : product _no , week_no , outlet_no. data looks like this 345 , 201522 , 98 567 , 201521 , 76 and so on.. I need to calc the no of outlets for each product every...

View Article

How can I order this?

Select distinct s from Student s left join fetch s.accounts where s.id=:studId The code above is valid....it shows all the accounts of the student with the correct id (studId) Now, all the accounts are...

View Article

Select DISTINCT from one column but ORDER BY another

I have a table with repeating Name column already in a specific order that I need to pull out only the DISTINCT values from Name column but they must stay in the order they are in the table. I thought...

View Article

bm table has duplicate rows in it . but i want to merge the bmto fbm without...

MERGE INTO fbm f USING (select distinct * form bm b) ON (f.EMPLOYEE_ID= b.EMPLOYEE_ID) WHEN MATCHED THEN UPDATE SET f.EMPLOYEE_ID = b.EMPLOYEE_ID WHEN NOT MATCHED THEN INSERT VALUES(b.EMPLOYEE_ID);

View Article


How to have SQL "filter" by distinct values but not delete

This will take some explaining so bear with me. The file, projections, has 56,037 rows. There are 29 columns but only two are really all that relevant. The main purpose of this is to organize the data...

View Article

how to calculate annual averages based on distinct combinations

So I have a table of 146510 rows. The schema and sample data are given below.      create table test2 ( year char(4) qtr char(2), area char(6), industry char(3), employment numeric(8,0) );...

View Article

Browsing latest articles
Browse All 38 View Live