473,408 Members | 2,477 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Postgre subquery help

17
Is there a better way to write the statement below with postgre. It works fine, wondering if there might be a way with with only 1 extract. I just need only results returned if they fall on a 10 minute interval. Thanks.

SELECT * FROM t1
WHERE EXTRACT(minute FROM timestamp) = 0 OR
EXTRACT(minute FROM timestamp) = 10 OR
EXTRACT(minute FROM timestamp) = 20 OR
EXTRACT(minute FROM timestamp) = 30 OR
EXTRACT(minute FROM timestamp) = 40 OR
EXTRACT(minute FROM timestamp) = 50;
Jan 20 '08 #1
2 3261
rski
700 Expert 512MB
Is there a better way to write the statement below with postgre. It works fine, wondering if there might be a way with with only 1 extract. I just need only results returned if they fall on a 10 minute interval. Thanks.

SELECT * FROM t1
WHERE EXTRACT(minute FROM timestamp) = 0 OR
EXTRACT(minute FROM timestamp) = 10 OR
EXTRACT(minute FROM timestamp) = 20 OR
EXTRACT(minute FROM timestamp) = 30 OR
EXTRACT(minute FROM timestamp) = 40 OR
EXTRACT(minute FROM timestamp) = 50;
maybe it would work
SELECT * FROM t1
WHERE EXTRACT(minute FROM timestamp) in (0,10,20,30,40,50);
Jan 20 '08 #2
ktrw25
17
Thanks, worked great.
Jan 22 '08 #3

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

Similar topics

2
by: Jason Tesser | last post by:
I am looking into using PostgreSQL on the backend here. I work for a Bible College. We are putting together a new software package. The database would be on a LInux box but our domain is M$ so we...
0
by: COXJ94 | last post by:
I have these postgre dbs, and I know nothing about them. I do know that I need to migrate them to db2. I've done someresearch and I think pg_dump with extract the ddls from postgre much like...
8
by: Andrew McNab | last post by:
Hi folks, I have a problem with an MS Access SQL query which is being used in an Access Report, and am wondering if anyone can help. Basically, my query (shown below) gets some records from a...
7
by: K. Crothers | last post by:
I administer a mechanical engineering database. I need to build a query which uses the results from a subquery as its input or criterion. I am attempting to find all of the component parts of...
1
by: Pradeep83 | last post by:
Hi Everybody Can anybody help me where i can open source for postgre sql that is compatiable for Soalris 10 OS.and how to install the same after downloading , As I am new to this Database...
14
Sakalicek
by: Sakalicek | last post by:
Hi all, could you please help me with my big problem? I have WebService on IIS. This WebService has methods to control database stored on server. I am using Postgre database and to access to...
1
by: jcf378 | last post by:
Hi all-- Does anyone have any insight as to how I might create a search form that allows a user to select criteria based on any related table in the whole database. The search form I have now only...
1
by: nilart | last post by:
Hi, I have an installer application (Installshield) which installs postgre DB programmatically on windows: I have a requirement where postgre DB is expected work after upgrading OS from windows XP...
4
by: lion cave | last post by:
Hi, I have a problem regarding on making function in postgre. I am newbie for this. My problem is that i want to make a function in postgre that accepts the name of the table. In the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.