Questions tagged [analytical]

82 questions
1
vote
1 answer

Mixpanel.track from the controller

I have an application that has a simple form submission (an email). I have MixPanel's tracking analytics integrated into the app, and want to track every time an interaction with this form happens--specifically, when a user…
Utopia025
  • 1,181
  • 3
  • 11
  • 21
1
vote
0 answers

SQL to flag errors and get latest valid status

Please help with the below scenario, I have set of records that I need to loop over for a given ID and Case_Type and mark the record as Valid or ERROR. Since it is an Audit table, the events has to be in order, like open/pend/done or open/done So…
sahil
  • 11
  • 2
1
vote
1 answer

Analytic function performance costly

I have a table_A (C1,C2,C3,.....,Cn, datestamp) Note : Column datestamp is indexed QRY1 select * from (select max(datestamp) dates from table_A) t, table_A where a.datestamp = t.dates QRY2 select * from ( select a.* , max (datestamp)…
Avi
  • 1,115
  • 8
  • 20
  • 30
1
vote
1 answer

Find minimum trips to link 500 bulbs to 500 switches

There are 500 bulbs in the hall of a palace. The switch control(with 500 switches) for these bulbs is located in another room. Unfortunately the switches are not marked with the bulb numbers. A new worker arrives. What is the minimum number of trips…
Guna
  • 33
  • 5
1
vote
1 answer

Oracle Lag- determine if previous row columns are the same as current row

Is it possible using analytical functions in oracle (lag for instance) to check the previous row, and based on 2 columns, determine if these values are exactly the same as the current row. If they are, then output the letter 'Y', else 'N'. Something…
Lock
  • 5,422
  • 14
  • 66
  • 113
1
vote
1 answer

Analytical gem on Heroku error

Good morning. I am trying to use this gem: https://github.com/jkrall/analytical On Heroku. It runs dandy on my local environment, but on Heroku busts out with: 2012-10-31T13:52:28+00:00 app[web.1]: /usr/local/lib/ruby/1.9.1/syck.rb:135:in `load':…
John R
  • 301
  • 3
  • 14
1
vote
2 answers

how to get num uniques week to date but having the unique period roll with date

Very simplified, a table with some sample data: action_date account_id 1/1/2010 123 1/1/2010 123 1/1/2010 456 1/2/2010 123 1/3/2010 789 For the data above, I need a query that will give the following: action_date num_events …
user1327961
  • 452
  • 2
  • 8
1
vote
2 answers

sql query logic

I have following data set a b c `1` 2 3 3 6 9 9 2 11 As you can see column a's first value is fixed (i.e. 1), but from second row it picks up the value of column c of previous…
hanumant
  • 1,091
  • 4
  • 15
  • 27
0
votes
2 answers

Query to count and filter records

This is my data: ACCOUNT PARTNER ADDRS_NUM HL124 2341 ASD123 HL124 2341 SDF234 HL124 234N SDF234 HG225 45BV QWE345 HG225 72AA QWE345 UY150 8846 CCC204 Need to get ACCOUNT that has more than one PARTNER & ADDRS_NUM are…
team 9
  • 11
  • 3
0
votes
0 answers

How to use analytical and grouping functions in one query in SQL Developer

How can I use analytical and grouping function in one query? I see error "ORA-00979:-not a GROUP BY expression". Below my query: Select date1, TO_CHAR(date1, 'IW') as NO_OF_WEEK, extract(month from date1) as NO_OF_MONTH, count(sales_pln) as…
0
votes
1 answer

Oracle PL/SQL: A SELECT statement replicating the START_DATE of the first record with END_DATE NOT NULL

This is the starting situation: If END_DATE is NOT NULL, then the previous empty records (= records with NO START_DATE and NO END_DATE) have to be filled with the START_DATE referred to that END_DATE. The final situation has to be the…
UltraCommit
  • 2,236
  • 7
  • 43
  • 61
0
votes
1 answer

Circle-Circle Intersection in 3D space

I have 2 circles C1 and C2 which lies on 2 different planes in 3D space. I want to intersect those circles and find the intersection points. Inputs : C1(x,y,z), Radius R1 and Plane P1 C2(x,y,z), Radius R2 and Plane P2. For 2D we can do it easily…
aadhithyan
  • 49
  • 10
0
votes
1 answer

Error while using Window Clause in Oracle Query

I have been looking at this code for the past two days now and I can not seem to get it to work. It does work without the Window clause though. It keeps giving me: ORA-00907: missing right parenthesis. select P.*, first_value(product_name)…
Narms
  • 3
  • 2
0
votes
2 answers

Counting id for both days SQL

Can anyone help me, please? The task is to find the number of rides taken by drivers who took a ride on both days create table rides ( ride_id int, driver_id int, ride_in_kms int, ride_fare float, ride_date date ); insert…
kake
  • 23
  • 3
0
votes
2 answers

Is it possible to find out the number of items in a row by using window functions in PostgreSQL?

how to find the number of sellers who have payments, the time between which in a row is less than 1 minute and which are executed at least 3 times in a row? (answer is 2 sellers) and how to calculate the number of such payments? (answer is 10…
bwoah
  • 25
  • 7