473,805 Members | 2,143 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to retrive value for 12 hours

5 New Member
Hi,

I have table called CUSTOMER with the following fields and values

Interval_date rec_value
------------- ----------
10/1/2007 5:30:00 12.0
10/1/2007 6:00:00 17.0
10/1/2007 7:00:00 15.0
.
.
.
.
.
11/2/2007 5:30:00 18.0
11/2/2007 6:00:00 12.0
11/2/2007 6:30:00 21.0
11/2/2007 7:00:00 11.0

We have data in CUSTOMER table for every 30minutes.

My objective is to write a SQL query to retrieve the MININUM rec_value between 6:00:00PM(eveni ng) on a given date untill 6:00:00AM the following morning

ex: 11/1/2007 6:00:00PM to 12/1/2007 6:00:00AM.

I have tried following query but din't work.

select interval_date min(rec_value)
from CUSTOMER
WHERE interval_date BETWEEN TRUNC(interval_ date) +18/24 AND TRUNC(interval_ date) +6/24
GROUP BY interval_date;

Any clue as to how we can use date along with timestamp?

Your prompt reply is greatly appreciated.


Thanks & Regards
Naveen
Feb 15 '08 #1
1 1355
amitpatel66
2,367 Recognized Expert Top Contributor
Hi,

I have table called CUSTOMER with the following fields and values

Interval_date rec_value
------------- ----------
10/1/2007 5:30:00 12.0
10/1/2007 6:00:00 17.0
10/1/2007 7:00:00 15.0
.
.
.
.
.
11/2/2007 5:30:00 18.0
11/2/2007 6:00:00 12.0
11/2/2007 6:30:00 21.0
11/2/2007 7:00:00 11.0

We have data in CUSTOMER table for every 30minutes.

My objective is to write a SQL query to retrieve the MININUM rec_value between 6:00:00PM(eveni ng) on a given date untill 6:00:00AM the following morning

ex: 11/1/2007 6:00:00PM to 12/1/2007 6:00:00AM.

I have tried following query but din't work.

select interval_date min(rec_value)
from CUSTOMER
WHERE interval_date BETWEEN TRUNC(interval_ date) +18/24 AND TRUNC(interval_ date) +6/24
GROUP BY interval_date;

Any clue as to how we can use date along with timestamp?

Your prompt reply is greatly appreciated.


Thanks & Regards
Naveen
Try this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT select interval_date min(rec_value)
  3. from CUSTOMER
  4. WHERE TO_CHAR(interval_date,'DD/MM/YY HH12:MI:SS PM') BETWEEN TO_DATE('11/01/2007 06:00:00 PM','DD/MM/YYYY HH12:MI:SS PM') AND TO_DATE('11/02/2007 06:00:00 AM','DD/MM/YYYY HH12:MI:SS PM')
  5.  
  6.  
Feb 15 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2753
by: Allan | last post by:
I use select @@identity to return @@identity from my store procedure, but I could not retrive it from my Visual basic code, like variable= oRS.fields.item(0).value, it always says item can not be found....
2
2146
by: Goran | last post by:
I'm a student and I've just started to learn Visual Studio.NET. I have a project to make a web application. I have a problem to connect to the database and retriving the PassType of the tblEmployee. First I create Bussines Object user.vb and I declare in it: Public Class EmployeeDetails Public EmpIdNo As Integer Public Name As String
1
1703
by: TdarTdar | last post by:
Hello, what is the code to get the running applications "ApplicationId" Thanks Tdar
2
2131
by: Gian Paolo | last post by:
Hi all on .net 2.0 i have a dataset and a table with some rows. Is there a way to retrive the current row index ? So i can retrive other value of that column... something like dataset.table.columnname.value regards paolo
0
1277
by: avishekb | last post by:
can anyone suggest me how to retrive data from a xml file using c/c++. for example: <schema> <applt to>portno</applyto> <type>int</type> <value>8080</value> </schema> i want to retrive the value 8080 from the file and assign it to portno,so that when i am using portno in my program it will be replaced by 8080.
0
1663
nehashri
by: nehashri | last post by:
hi, I need one help regarding Asp with MsAccess database. Problem. ======== i want to retrive stored image from the MSAccess database using asp.
2
1910
idsanjeev
by: idsanjeev | last post by:
hello how can retrive the input text after submit button pressed and report a error message. i wants to post topic and if any error message is occured then retrive the inputed text but it forget its <%@ Language=VBScript%> <%Option Explicit If Request.Cookies("userid") = "" Then Response.Redirect "login.asp" Else Dim R, page,vopenflg Dim vlaunchby,i,vcount
1
1679
idsanjeev
by: idsanjeev | last post by:
hello i wants to retrive data in textarea like input text but in textarea value is not work so what should be use to retrive textarea value after any error <input type="text" name="name" value="<%=name%>"> [/code>
10
1777
by: arial | last post by:
Hi all, I need some help on retrive the value from query string. I have two web forms. One has the datagridview which displays the data from database. On one of the column I made a hyperlink to go to next page like, qi.aspx?qi_track={0} and now I need to open a detail of this qi_track on second page. how can I extract the value of qitrack from the url.
1
1889
by: abirami elango | last post by:
Hi, i have created a web application in vb.net. i have assigned a value to the textbox during page UNLOAD event as below.. ......... Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload txtPopConfirm.Text = intCountAnswer1 End Sub
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10613
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10363
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10368
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7649
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5544
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4327
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.