As a suggestion, try doing this outside of your application first,
simply by running sqlite3 from the command line. That way you can see if
the problem has is because of something you're doing vs. sqlite itself.
The join syntax I suggested (including the rtrim function) works fine
here using the current release of sqlite, as does the "inner join"
syntax.

- Jeff

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Johnstone, Simon
Sent: Monday, February 11, 2008 11:44 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Join trouble

I have tried the following but get the following error 

Warning: sqlite_query() [function.sqlite-query]: no such function: rtrim
in C:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\swiftdist\website\database\loginsuccess.php
on line 22
SQL logic error or missing database
SELECT tblusers.company, tblcompany.company FROM tblusers, tblcompany
WHERE rtrim(tblusers.company) = rtrim(tblcompany.company)

How do I create the sql statement so that it includes the functions????
I followed the link you suggested but it was a bit too complicated for
me I am a very very new programmer.

I have also tried 

$query = "SELECT a.company, b.company FROM tblusers a inner join
tblcompany b on (a.company = b.company) ";

This works but yet again doesn't print any results to the screen.

Simon Johnstone
Customer Service Data Officer

Tel + 44 (0) 1484 465 500 Ext 5154
Fax: +44 (0) 1484 465 586
E-mail [EMAIL PROTECTED]
Web: www.davidbrown.com

David Brown Engineering Limited
Company No 331925 England
Park Works, Park Road, Huddersfield HD4 5DD England

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Fowler, Jeff
Sent: 11 February 2008 16:17
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Join trouble

Simon,

If the query is returning no rows, my guess would be trailing spaces in
the data. This has been discussed at length and there is a new collating
sequence (http://www.sqlite.org/cvstrac/chngview?cn=4732)to address it.
Either use it or try saying:
WHERE rtrim(tblusers.company) = rtrim(tblcompany.company)

- Jeff

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Johnstone, Simon
Sent: Monday, February 11, 2008 11:11 AM
To: sqlite-users@sqlite.org
Subject: [sqlite] Join trouble

I am having serious trouble creating a join on my database. I have
tested it in other databases and it works so it must be a problem with
sqlite and the join??? I don't know but am really struggling. 

 

$query = "SELECT name, username, currency, company, salescontact,
orders2006, orders2007, sales2006, sales2007, company FROM tblusers,
tblcompany WHERE tblusers.company = tblcompany.company";

 

The page loads up but there is just no data from the database, if I use
any of the databases on their own they work fine its only when I join
them

 

Cheers for any help

 

Simon Johnstone

Customer Service Data Officer

 

Tel + 44 (0) 1484 465 500 Ext 5154

Fax: +44 (0) 1484 465 586

E-mail [EMAIL PROTECTED]
<blocked::mailto:[EMAIL PROTECTED]> 

Web: www.davidbrown.com <blocked::http://www.davidbrown.com/> 

 

David Brown Engineering Limited

Company No 331925 England

Park Works, Park Road, Huddersfield HD4 5DD England

 

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

Reply via email to