Skip to main content

Questions tagged [distinct]

1 vote
1 answer
66 views

I have these two tables in a SQLite 3 database: The first table contains four points in a 2D space. The columns X and Y are the coordinates. The second table represents the segments that form a ...
VansFannel's user avatar
  • 1,885
17 votes
1 answer
2k views

I have the following query and expect that as a result I will have a list of IDs without duplicates. But sometimes it produces duplicates (1-2 on 4 million rows). Why can it happen? I run it with the ...
Novitskiy Denis's user avatar
1 vote
1 answer
73 views

I'm running into performance problems with a query that buckets a set of historical records of daily counts into a form that can be rendered easily as a daily graph. Context Essentially, the table in ...
hampercm's user avatar
  • 111
-1 votes
1 answer
197 views

I need the count of unique values, and am trying to use Oracle's COUNTDISTINCT() function to obtain that: select COUNTDISTINCT(a.m_label) from user_rep a, user_group_rep b, trn_grp_rep c ...
Mikhail T.'s user avatar
1 vote
1 answer
95 views

I've got a database full of documents which each contain a collection of transactions: [ { "key": 1, "data": [ { "trans": 1, "uid&...
ralmond's user avatar
  • 13
2 votes
1 answer
521 views

A while back I asked this question about efficiently selecting unique permutations of columns in Postgres. Now I have a follow-up question regarding how to do so, with the addition of being able to ...
hunter's user avatar
  • 217
0 votes
2 answers
380 views

I have an activity_log table that I need to derive a basic output of how many distinct users logged in that day, and sum up them up day by day. The table logs all actions of a user and will have ...
JDBA's user avatar
  • 3
0 votes
1 answer
107 views

A lot of values are stored in values. The data is in a hierarchical order, so there could be a probe, on which some measurements have been performed. Many points have been archived with strain and ...
lrahlff's user avatar
1 vote
2 answers
958 views

I have the following table. Column | Type | Collation | Nullable | Default ----------+-----------------------------+-----------+----------+--------- code | text ...
Zephyrus's user avatar
  • 283
0 votes
0 answers
303 views

Let's say we have a table Daily_users which has the columns student_id, school_id, grade, timestamp. We collect usage data of students daily and so the table grows daily (note that there could be ...
dezdichado's user avatar
0 votes
1 answer
158 views

I have a table (still on MySQL 5.7) with lots of data. This table is written by some scripts. It works like a "checkin", where each agent is checking in in some period of time. It looks like ...
Marek's user avatar
  • 13
0 votes
1 answer
66 views

I had some confusion regarding distinct keyword... For example Table test has 5 columns a b c d e, and column a has repeated value, and I want to use distinct keyword to get distinct values while also ...
datascinalyst's user avatar
19 votes
1 answer
1k views

Can anyone explain the below situation, where two seemingly equal values are not reduced by DISTINCT? The query above is SELECT DISTINCT name FROM master.sys.dm_os_spinlock_stats where name = '...
jimbobmcgee's user avatar
2 votes
1 answer
1k views

Can it be considered a bug? This query gives duplicate values despite DISTINCT: select distinct '1' from ( select * from dual connect by level <= 10 ) order by dbms_random.value fetch first 10 ...
Andy DB Analyst's user avatar
1 vote
1 answer
2k views

I haven't had to use SQL in years and I'm clearly rusty. I have a situation where I'm trying to insert multiple rows into table A. There are two columns of data to be inserted, the first is a "...
Amy Lee's user avatar
  • 13

15 30 50 per page
1
2 3 4 5
10