Subject RE: [firebird-support] SELECT ... WHERE ... BETWEEN using TIMESTAMP felds
Author Codebue Fabio - P-Soft
Sorry


CREATE TABLE LSV (
ART_CODICE VARCHAR(20) DEFAULT '' ,
DESCRIZIONE VARCHAR(40),
DATA_ORA TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PREZZO NUMERIC(18,6) DEFAULT 0

);


INSERT INTO TABLE_NAME (ART_CODICE, DESCRIZIONE1, DATA_ORA, PREZZO) VALUES
('CDC.KR.XQ', 'POWER LINE KRAUN 200MBPS BRIDGE HOMEPLUG', '25-OCT-2008
05:18:40', 65);
INSERT INTO TABLE_NAME (ART_CODICE, DESCRIZIONE1, DATA_ORA, PREZZO) VALUES
('CDC.ZY.66', 'ROUTER ADSL2+ ZYXEL WI-FI PRESTIGE 660HW', '25-OCT-2008
05:18:40', 79);
INSERT INTO TABLE_NAME (ART_CODICE, DESCRIZIONE1, DATA_ORA, PREZZO) VALUES
('CDC.HS.14', 'STAMPANTE HP DESKJET 6940', '30-MAR-2009 08:47:16', 90);
INSERT INTO TABLE_NAME (ART_CODICE, DESCRIZIONE1, DATA_ORA, PREZZO) VALUES
('CDC.86.HV', 'NB HP PAVILION DV7-1110EL', '20-APR-2009 13:48:09', 930);
INSERT INTO TABLE_NAME (ART_CODICE, DESCRIZIONE1, DATA_ORA, PREZZO) VALUES
('CDC.KR.3W', 'KRAUN KIT ROUTER ADSL2/2+ WI-FI + USBKEY', '20-APR-2009
13:53:16', 59);
INSERT INTO TABLE_NAME (ART_CODICE, DESCRIZIONE1, DATA_ORA, PREZZO) VALUES
('CDC.SE.23', 'HDD SEAGATE 160GB PATA 7200RPM', '20-APR-2009 13:55:11',
42.5);
INSERT INTO TABLE_NAME (ART_CODICE, DESCRIZIONE1, DATA_ORA, PREZZO) VALUES
('CDC.WD.86', 'HDD ESTERNO WD MY BOOK ESSENTIAL 1TB', '20-APR-2009
13:56:57', 105);


Select Art.DATA_ORA,Art.Codice,Art.Descrizione1,Lsv.Prezzo from Lsv,ART
where LSV.ART_CODICE=ART.CODICE
AND LSV.DATA_ORA between CAST('03/20/2009 00:01:00' AS TIMESTAMP) and
CAST('04/20/2009 23:59:00' AS TIMESTAMP)
ORDER BY DATA_ORA




Codebue Fabio
.--------------------------------.
P-Soft di Codebue Fabio & C. sas
via B.Storti, 19
24060 Chiuduno - BG
Phone: +39.035.839435
Mobile: +39.348.3515786
Fax: +39.030.5100306
.-----------------------------.
Web : www.p-soft.biz
EMail: f.codebue@...



-----Original Message-----
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Dimitry Sibiryakov
Sent: Monday, April 20, 2009 2:54 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] SELECT ... WHERE ... BETWEEN using TIMESTAMP
felds

> DATA_ORA TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
>
> INSERT INTO TABLE_NAME (ART_CODICE, DESCRIZIONE1, DATA_ORA, PREZZO) VALUES
> ('25-OCT-2008 05:18:40', 'CDC.KR.XQ', 'POWER LINE KRAUN 200MBPS BRIDGE
> HOMEPLUG', 65);
>
> I don't have to retrieve first two lines?
> Any idea?

Tell me, how you managed to insert 'POWER LINE KRAUN 200MBPS BRIDGE
HOMEPLUG' into timestamp field DATA_ORA?
As to results of your query - DATA_ORA in them definitely isn't
timestamp because 25/10/2009 isn't a valid date. Besides, it is selected
from table different to which limits are put on.

SY, SD.


------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Yahoo! Groups Links