Re: [sqlite] JOIN on between

2012-01-11 Thread Igor Tandetnik

On 1/11/2012 3:49 PM, Pawl wrote:

select errorapi.*,login.* from errorapi JOIN login on (errorapi.start
between login.start and login.ende)

This command show only one end record. It is possible to use JOINS?


I don't see anything wrong with the query. If it only reports one 
record, that must be because there's only one pair of records (one from 
errorapi and the other from login) that satisfies the condition. Check 
your data; in particular, verify that login.ende is populated correctly.

--
Igor Tandetnik

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] JOIN on between

2012-01-11 Thread Pawl

Hi,

I need to join two table according to range of date. 

Fist table is error log table second is users{operators} login. 
I need to show complete table with all error with actual user id.

CREATE TABLE [login] (
[id] iNTEGER  NOT NULL,
[start] TIMESTAMP DEFAULT (datetime('now','localtime')) NOT NULL,
[ende] TIMESTAMP  NULL,
FOREIGN KEY(id) REFERENCES operators(id)
)

CREATE TABLE [errorapi] (
[start] TIMESTAMP DEFAULT (datetime('now','localtime')) NOT NULL,
[konec] TIMESTAMP,
[describe] TEXT  NOT NULL,
[track] TEXT,
[account] TEXT,
[priority] INTEGER
)

select errorapi.*,login.* from errorapi JOIN login on (errorapi.start
between login.start and login.ende)

This command show only one end record. It is possible to use JOINS? 

I don't want to add operator_id as columb, because I have more tables when I
want to show this.

Lot of thanks, 

Pavel Samek

-- 
View this message in context: 
http://old.nabble.com/JOIN-on-between-tp33124032p33124032.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users