Questions tagged [query-help]

14 questions
7
votes
3 answers

Mathematical formula for calculating call duration

I was working for a telecom company some years ago and I had to generate a formula which calculates duration of a call according to the following algorithm: t1 is the first period t2 is the recurring period RCT is the actual call time (in…
Adrian
6
votes
2 answers

MySQL - find difference between rows of the same table

I have a table containing aggregated results with timestamps - meaning each result per time is the total so far: date | time | ip | result --------------------------------------- 2011-03-01 | 10:00 | 10.0.0.1 | 200 2011-03-01 | 11:00 |…
sa125
  • 28,121
  • 38
  • 111
  • 153
2
votes
1 answer

Calculate sum of absolute difference in rows by groups

I have a problem which I have been able to solve using Stata, but now my data has grown to a size that I cannot process it from memory any more. I hope to do this in MySQL instead. I am trying to calculate the Manhattan distance of items between n…
master_od
  • 67
  • 7
1
vote
3 answers

SQL Statement Help - Select Only Customers with no order for past 3 months

Hope you all are fine. I need to make a query. Kindly help me with this. Here is the Scenario. We have two Tables Customers Orders I want to get only those customers which have not ordered anything for the past three months Kindly help me. I am…
user695310
  • 13
  • 1
  • 3
1
vote
5 answers

Update Statements

I am a beginner SQL user (not formally trained; OJT only) and need some assistance with a simple update statement. I would like to write an update statement that allows me to list ID's. The statement shown below is how I am currently writing it. …
Erin Karschnik
  • 157
  • 2
  • 11
1
vote
3 answers

SQL query help with GROUPing and nested queries

Given are two tables, Table A containing customerid, lastchange, internallink Table B containing internallink, turnover (I'm simplyfying here and changing it to a generic example, the actual structure is more complex. SQL dialect for now is…
foo
  • 1,968
  • 1
  • 23
  • 35
0
votes
0 answers

Calculate Daily/Monthly Energy consumption in SQL Server

I have a SQL Server table Energy_CC with two columns: time [int] (Epoch time) and E_CC14 [float]. Every 30 minutes, the total amount of my energy (kWh) is appended to the data table - something like…
0
votes
1 answer

Accessing the requested url with the query helper

what I need; api/GetCharacteristicsBulk?versionCode=RTUK8L1&language=2 go to this address. var urlCode = selectedVersionCode + "&" + "language=" + language; string url =…
jyn
  • 3
  • 1
0
votes
2 answers

I need help parsing an HL7 string with TSQL

I have a column in a table that looks like this Name WALKER^JAMES^K^^ ANDERSON^MICHAEL^R^^ HUFF^CHRIS^^^ WALKER^JAMES^K^^ SWEARINGEN^TOMMY^L^^ SMITH^JOHN^JACCOB^^ I need to write a query that looks like…
0
votes
8 answers

How to do conditional SQL Server statements?

I have a database with event information, including date (in MMDDYYYY format). is it possible to write an SQL Server statement to only get rows that fall within a certain time frame? something like this pseudo-statement: SELECT * FROM events WHERE…
Anders
  • 12,088
  • 34
  • 98
  • 146
0
votes
1 answer

sum based on max production date and min production date MTD,WTD, YTD SQL Server

Hello I am trying to create a automated query that displays month to date, year to date, and week to date and creates a column for each. I need to sum balance amount if the production date is the maximum - the minimum production date sum of…
Beast
  • 3
  • 4
0
votes
2 answers

How do I join all rows with the same name in one table using MYSQL?

Suppose I have a database called clubmembership that has a column for names, a column for clubs, and a column for the role they play in that club. The name Margrit would be in the column name many times, or as many times as she is in a club. If I…
0
votes
1 answer

How to Show Null in a Cell in MS Access 2010

Alright, so I'm trying to run a query that to display a null value in a field if a duplicate ID exist. There are 2 tables, parent-child relationship. The parent table can have one to many child records. In my scenario, we have fuel tanks that can…
dotNetUser
  • 47
  • 1
  • 1
  • 5
-1
votes
1 answer

Need help developing SQL to find difference in date

I am attempting to write a query that will take a date value and return a numerical value. What I plan to use this for is to track the days until an inspection is due. For example I will input the inspection expiration date into the database, then I…
chriss
  • 1,528
  • 4
  • 13
  • 18