pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedCan someone tell me why this statement is failing?
5+ messages / 5 participants
[nested] [flat]
* Can someone tell me why this statement is failing?
@ 2004-04-19 20:31 P A <patkins2474@yahoo.com>
2004-04-20 14:40 ` Re: Can someone tell me why this statement is failing? Martin Marques <martin@bugs.unl.edu.ar>
2004-04-20 14:42 ` Re: Can someone tell me why this statement is failing? Edmund Bacon <ebacon@onesystem.com>
2004-04-20 15:32 ` Re: Can someone tell me why this statement is failing? Rod Taylor <pg@rbt.ca>
2004-04-21 08:53 ` Re: Can someone tell me why this statement is failing? denis@coralindia.com
0 siblings, 4 replies; 5+ messages in thread
From: P A @ 2004-04-19 20:31 UTC (permalink / raw)
To: pete@tkins.com; +Cc: pgsql-sql
Can anyone tell me why this SQL statement is not
matching with the row from the table below? I think
I'm going mad!
#####################################
SQL Statement
#####################################
SELECT * FROM t_bell_schedule WHERE calendar_day =
'2004-04-12' AND start_time_minutes >= '1082374200'
AND end_time_minutes <= '1082375100';
#####################################
Current DB Data to match
#####################################
calendar_day | period_letter | start_time_minutes |
end_time_minutes
--------------+---------------+--------------------+------------------
2004-04-12 | B | 1082374440 |
1082377320
#####################################
DB Structure
#####################################
Column | Type |
Modifiers
--------------------+-----------------------------+--------------------------------------------------------------------------------
bell_schedule_uid | integer |
not null default
nextval('public.t_bell_schedule_bell_schedule_uid_seq'::text)
calendar_day | date |
period_letter | character varying(4) |
period | character varying(4) |
start_time | time without time zone |
end_time | time without time zone |
total_minutes | integer |
activestatus | integer |
datecreated | timestamp without time zone |
datemodified | timestamp without time zone |
start_time_minutes | integer |
end_time_minutes | integer |
Cheers,
Pete
__________________________________
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
http://photos.yahoo.com/ph/print_splash
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Can someone tell me why this statement is failing?
2004-04-19 20:31 Can someone tell me why this statement is failing? P A <patkins2474@yahoo.com>
@ 2004-04-20 14:40 ` Martin Marques <martin@bugs.unl.edu.ar>
3 siblings, 0 replies; 5+ messages in thread
From: Martin Marques @ 2004-04-20 14:40 UTC (permalink / raw)
To: P A <patkins2474@yahoo.com>; pete@tkins.com; +Cc: pgsql-sql
El Lun 19 Abr 2004 17:31, P A escribió:
> Can anyone tell me why this SQL statement is not
> matching with the row from the table below? I think
> I'm going mad!
>
> #####################################
> SQL Statement
> #####################################
>
> SELECT * FROM t_bell_schedule WHERE calendar_day =
> '2004-04-12' AND start_time_minutes >= '1082374200'
> AND end_time_minutes <= '1082375100';
start_time_minutes and end_time_minutes are integer data types, so don't
enclose the values in quotes.
> start_time_minutes | integer |
> end_time_minutes | integer |
--
11:38:01 up 42 days, 16:05, 4 users, load average: 0.48, 0.61, 0.55
-----------------------------------------------------------------
Martín Marqués | select 'mmarques' || '@' || 'unl.edu.ar'
Centro de Telematica | DBA, Programador, Administrador
Universidad Nacional
del Litoral
-----------------------------------------------------------------
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Can someone tell me why this statement is failing?
2004-04-19 20:31 Can someone tell me why this statement is failing? P A <patkins2474@yahoo.com>
@ 2004-04-20 14:42 ` Edmund Bacon <ebacon@onesystem.com>
3 siblings, 0 replies; 5+ messages in thread
From: Edmund Bacon @ 2004-04-20 14:42 UTC (permalink / raw)
To: P A <patkins2474@yahoo.com>; +Cc: pete@tkins.com; pgsql-sql
Your end time minutes is NULL, comparing NULL to anything (even NULL
itself) yields NULL so you either need to:
SELECT * FROM ... WHERE ... AND (end_time_minutes IS NULL OR
end_time_minutes <= '1082375100');
or
SELECT * FROM ... WHERE ... AND coalsece(end_time_minutes, 0) <=
'1082375100';
P A wrote:
>Can anyone tell me why this SQL statement is not
>matching with the row from the table below? I think
>I'm going mad!
>
>#####################################
>SQL Statement
>#####################################
>
>SELECT * FROM t_bell_schedule WHERE calendar_day =
>'2004-04-12' AND start_time_minutes >= '1082374200'
>AND end_time_minutes <= '1082375100';
>
>#####################################
>Current DB Data to match
>#####################################
>
> calendar_day | period_letter | start_time_minutes |
>end_time_minutes
>--------------+---------------+--------------------+------------------
> 2004-04-12 | B | 1082374440 |
> 1082377320
>
>#####################################
>DB Structure
>#####################################
>
> Column | Type |
> Modifiers
>--------------------+-----------------------------+--------------------------------------------------------------------------------
> bell_schedule_uid | integer |
>not null default
>nextval('public.t_bell_schedule_bell_schedule_uid_seq'::text)
> calendar_day | date |
> period_letter | character varying(4) |
> period | character varying(4) |
> start_time | time without time zone |
> end_time | time without time zone |
> total_minutes | integer |
> activestatus | integer |
> datecreated | timestamp without time zone |
> datemodified | timestamp without time zone |
> start_time_minutes | integer |
> end_time_minutes | integer |
>
>
>Cheers,
>Pete
>
>
>
>
>
>__________________________________
>Do you Yahoo!?
>Yahoo! Photos: High-quality 4x6 digital prints for 25¢
>http://photos.yahoo.com/ph/print_splash
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster
>
>
--
Edmund Bacon <ebacon@onesystem.com>
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Can someone tell me why this statement is failing?
2004-04-19 20:31 Can someone tell me why this statement is failing? P A <patkins2474@yahoo.com>
@ 2004-04-20 15:32 ` Rod Taylor <pg@rbt.ca>
3 siblings, 0 replies; 5+ messages in thread
From: Rod Taylor @ 2004-04-20 15:32 UTC (permalink / raw)
To: P A <patkins2474@yahoo.com>; +Cc: pete@tkins.com; pgsql-sql
> Can anyone tell me why this SQL statement is not
> matching with the row from the table below? I think
> I'm going mad!
Indeed. The row is NOT in that range.
1082377320 is > 1082375100 not <= it
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Can someone tell me why this statement is failing?
2004-04-19 20:31 Can someone tell me why this statement is failing? P A <patkins2474@yahoo.com>
@ 2004-04-21 08:53 ` denis@coralindia.com
3 siblings, 0 replies; 5+ messages in thread
From: denis@coralindia.com @ 2004-04-21 08:53 UTC (permalink / raw)
To: P A <patkins2474@yahoo.com>; pete@tkins.com; +Cc: pgsql-sql
Hi..
Your END_TIME_MINUTES condition fails..
1082377320 <= 1082375100
HTH.
Denis
----- Original Message -----
From: P A <patkins2474@yahoo.com>
To: <pete@tkins.com>
Cc: <pgsql-sql@postgresql.org>
Sent: Tuesday, April 20, 2004 2:01 AM
Subject: [SQL] Can someone tell me why this statement is failing?
> Can anyone tell me why this SQL statement is not
> matching with the row from the table below? I think
> I'm going mad!
>
> #####################################
> SQL Statement
> #####################################
>
> SELECT * FROM t_bell_schedule WHERE calendar_day =
> '2004-04-12' AND start_time_minutes >= '1082374200'
> AND end_time_minutes <= '1082375100';
>
> #####################################
> Current DB Data to match
> #####################################
>
> calendar_day | period_letter | start_time_minutes |
> end_time_minutes
> --------------+---------------+--------------------+------------------
> 2004-04-12 | B | 1082374440 |
> 1082377320
>
> #####################################
> DB Structure
> #####################################
>
> Column | Type |
> Modifiers
> --------------------+-----------------------------+-----------------------
---------------------------------------------------------
> bell_schedule_uid | integer |
> not null default
> nextval('public.t_bell_schedule_bell_schedule_uid_seq'::text)
> calendar_day | date |
> period_letter | character varying(4) |
> period | character varying(4) |
> start_time | time without time zone |
> end_time | time without time zone |
> total_minutes | integer |
> activestatus | integer |
> datecreated | timestamp without time zone |
> datemodified | timestamp without time zone |
> start_time_minutes | integer |
> end_time_minutes | integer |
>
>
> Cheers,
> Pete
>
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Photos: High-quality 4x6 digital prints for 25¢
> http://photos.yahoo.com/ph/print_splash
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2004-04-21 08:53 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-04-19 20:31 Can someone tell me why this statement is failing? P A <patkins2474@yahoo.com>
2004-04-20 14:40 ` Martin Marques <martin@bugs.unl.edu.ar>
2004-04-20 14:42 ` Edmund Bacon <ebacon@onesystem.com>
2004-04-20 15:32 ` Rod Taylor <pg@rbt.ca>
2004-04-21 08:53 ` denis@coralindia.com
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox