Re: [PHP-DB] Join on single table

2005-02-12 Thread Matthew Weier O'Phinney
* Micah Stevens [EMAIL PROTECTED]: What kind of speed do you need? I was aiming at something that would run in 2 hours or so. Currently, it takes around 3 - 4. I had to go to temp tables for a logging application, but not until my table got upwards of a million records or so.. For the

Re: [PHP-DB] Join on single table

2005-02-11 Thread Martin Norland
Matthew Weier O'Phinney wrote: I have a table which contains the following: id (primary key, auto incrementing) app_id (integer, foreign key) resource_id (integer, foreign key) word score (This is a search index.) I want to find all resource_ids from one app_id that match

Re: [PHP-DB] Join on single table

2005-02-11 Thread Matthew Weier O'Phinney
* Martin Norland [EMAIL PROTECTED]: Matthew Weier O'Phinney wrote: I have a table which contains the following: id (primary key, auto incrementing) app_id (integer, foreign key) resource_id (integer, foreign key) word score (This is a search index.) I want to

Re: [PHP-DB] Join on single table

2005-02-11 Thread Matthew Weier O'Phinney
* Micah Stevens [EMAIL PROTECTED]: Sounds like a self join should work wonders. I didn't test this, but the idea should work: select t1.app_id as a1, t2.app_id as a2, t2.word, t2.score from tablename as t1 left join tablename as t2 on t1.resource_id = t2.resource_id and t1.app_id !=

Re: [PHP-DB] Join on single table

2005-02-11 Thread Micah Stevens
What kind of speed do you need? I had to go to temp tables for a logging application, but not until my table got upwards of a million records or so.. For the numbers your quoting, it should be pretty quick unless your engine needs optimization.. On Friday 11 February 2005 11:56 am, Matthew

Re: [PHP-DB] JOIN problem

2005-02-08 Thread Zouari Fourat
am using mysql 3 so i can't do that subquery, how can we do that in mysql 3 ? On Mon, 7 Feb 2005 19:47:08 +, Simon Rees [EMAIL PROTECTED] wrote: On Monday 07 February 2005 18:22, Zouari Fourat wrote: Hello I have 2 tables with two columns in each one (cloned tables) like this : ID

Re: [PHP-DB] JOIN problem

2005-02-08 Thread Jochem Maas
Zouari Fourat wrote: am using mysql 3 so i can't do that subquery, how can we do that in mysql 3 ? and neither can anyone else ;-)... rather a pain, but mysql.com have been kind enough to give a detailed explaination on how to rewrite subselect queries as join queries: If you put your brain in

Re: [PHP-DB] JOIN problem

2005-02-07 Thread Zouari Fourat
that wont work :( and either when changing RIGHT to LEFT JOIN that wont work On Mon, 7 Feb 2005 13:41:01 -0500, Joseph Crawford [EMAIL PROTECTED] wrote: try doing this SELECT a.UserName FROM table1 a RIGHT OUTER JOIN table2 b ON (a.UserName != b.username) On Mon, 7 Feb 2005 19:22:15

Re: [PHP-DB] JOIN problem

2005-02-07 Thread Zouari Fourat
:( nothing On Mon, 7 Feb 2005 14:10:10 -0500, Joseph Crawford [EMAIL PROTECTED] wrote: try INNER JOIN? On Mon, 7 Feb 2005 19:47:29 +0100, Zouari Fourat [EMAIL PROTECTED] wrote: that wont work :( and either when changing RIGHT to LEFT JOIN that wont work On Mon, 7 Feb 2005

Re: [PHP-DB] JOIN problem

2005-02-07 Thread Simon Rees
On Monday 07 February 2005 18:22, Zouari Fourat wrote: Hello I have 2 tables with two columns in each one (cloned tables) like this : ID int(6) UserName varchar(25) and i would like to select usernames from table1 that doesnt appear in table2 so i did this : Depending on which database

Re: [PHP-DB] JOIN across db's in MySQL

2003-09-18 Thread jeffrey_n_Dyke
i asked this same question once and somehwere in the archives is a post by John Holmes that shows an example of how mysql allows db joins. its from last month i believe http://marc.theaimsgroup.com/?l=php-db but in short, mysql does support this using . db.table.field hth Jeff

Re: [PHP-DB] JOIN across db's in MySQL

2003-09-18 Thread Mike Tallroth
Thanks, I found the post from John Holmes and was able to reconstruct the query in mysql. But when I transferred that over to php and try to extract an associative array from each record, I found that only one column came out instead of two. By simply changing the query from: $query = select

Re: [PHP-DB] JOIN across db's in MySQL

2003-09-18 Thread Micah Stevens
You may be able to use mysql_fetch_array() and use numerical indexes to reference the redundant names, but isn't it easier and better to just assign aliases like you're doing? It makes for more readable code, that's for sure. -Micah On Thu September 18 2003 12:55 pm, Mike Tallroth wrote:

Re: [PHP-DB] join across databases - how to select databases?

2003-08-22 Thread jeffrey_n_Dyke
to my knowledge this is not possible in MySQL. There are only joins at the table level. I've been curious about this in the past myself, so if i'm incorrect, i'm hoping to hear it via this post. hth jeff

Re: [PHP-DB] join across databases - how to select databases?

2003-08-22 Thread CPT John W. Holmes
From: Moshe Weitzman [EMAIL PROTECTED] I have looked all over the web but can't find an example *in php* for connecting to a mysql server, selecting database(s), and issueing a query which joins across databases. I already know the SQL required to achieve a multiple database query. My

Re: [PHP-DB] join across databases - how to select databases?

2003-08-22 Thread CPT John W. Holmes
From: [EMAIL PROTECTED] to my knowledge this is not possible in MySQL. There are only joins at the table level. I've been curious about this in the past myself, so if i'm incorrect, i'm hoping to hear it via this post. You can stop hoping now. It is indeed possible. :) mysql select * from

Re: [PHP-DB] join across databases - how to select databases?

2003-08-22 Thread Moshe Weitzman
I assume something like the following would work, regardless of whether/how you've called mysql_select_db() SELECT t1.column FROM database1.table1 t1 JOIN database2.table2 t2 ON t1.id = t2.id If you have something working from the MySQL command line, then it's going to work from mysql_query() with

Re: [PHP-DB] join query/relational database question

2003-01-06 Thread Paolo Bonavoglia
At 16:09 06/01/2003 06/01/2003, Doug Parker wrote: I have a relational database issue that I'll simplify for the sake of this post. [...] So it would be like this: id | company_id | status| company 1

Re: [PHP-DB] join query/relational database question

2003-01-06 Thread Rick Widmer
At 04:09 PM 1/6/03 -0500, Doug Parker wrote: I have a relational database issue that I'll simplify for the sake of this post. I have one table, called clients, that has an id and the company name. For example: id | company --- 46 Jones Inc. 54 Baker Inc. etc.

Re: [PHP-DB] JOIN in embedded query

2002-08-08 Thread leo g. divinagracia iii
since you didnt list what type DB you are using, i assumed MYSQL. and MYSQL doesnt have sub SELECTs... :( http://www.mysql.com/doc/en/UPDATE.html the syntax lists ...WHERE where_condition... Michael Hendsbee wrote: UPDATE Emails SET Sent = 'T' WHERE ID = (SELECT Emails.ID FROM Emails

Re: [PHP-DB] JOIN statement not producing expected output

2002-05-20 Thread Bogdan Stancescu
Well, the first question is what's the expected output? If you're trying to get, say, title from table1 and rating from table2 and identify the books in table1 by the unique field id and in table2 by the field book_id, then this is what you should have to end up with: SELECT t1.title,

Re: [PHP-DB] JOIN statement not producing expected output

2002-05-20 Thread szii
If you're looking to do cross-table joins, I'd advise a good book/class on basic SQL or you're going to get in over your head very very quickly. SELECT * FROM table1,table2; This WILL run, but there's no where clause. Therefore it will return all of table1 matched against all of table 2.

Re: [PHP-DB] Join tables

2002-02-28 Thread Jennifer Downey
Ok thanks for that info, but I guess I am ignorant to what MS Access is. Please enlighten me. Thanks Jennifer Downey Marius Ursache [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]; the best tool for building join queries is MS Access . make a db same as that you use in mysql and

Re: [PHP-DB] Join tables

2002-02-28 Thread Aron Pilhofer
Microsoft Access: light-duty relational database with a world-class (in my opinion) GUI interface, but I don't think it's going to help you in this case. id in image_data has the same value as id in wt_users do you mean uid in wt_users? So, $id=session ID? I might set that ahead of time just

Re: [PHP-DB] Join

2002-02-21 Thread Jennifer Downey
Thank you Beau, Appreciate that clarification. Jen Beau Lebens [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... what you are referring to actually has nothing to do with PHP Jen - that's why the manual wasn't much help :) JOIN is an SQL command, so check out

RE: [PHP-DB] Join

2002-02-20 Thread Beau Lebens
what you are referring to actually has nothing to do with PHP Jen - that's why the manual wasn't much help :) JOIN is an SQL command, so check out the manual of your RDBMS (ie. http://www.mysql.com/doc/J/O/JOIN.html for MySQL) good luck :) Beau // -Original Message- // From: Jennifer

Re: [PHP-DB] JOIN Very SLOW...

2001-11-28 Thread Jon Farmer
I would suggest changing COUNT(*) to COUNT(properties.PropertyID) Regards Jon -- Jon Farmer Systems Programmer, Entanet www.enta.net Tel 01952 428969 Mob 07763 620378 PGP Key available, send email with subject: Send PGP Key - Original Message - From: Martin E. Koss [EMAIL PROTECTED]

Re: [PHP-DB] JOIN Very SLOW...

2001-11-28 Thread Andrey Hristov
You use LEFT JOIN so your query is optimized. Probably your tables are big, you don't have many MB of RAM. When you have big RAM, I think that tables reside in memory and join of 5 tables every 600,000 rows is done for 4-5s. May be you have to increase some of the buffers sizes of mysql.

Re: [PHP-DB] JOIN - Not working.

2001-11-28 Thread Daniel Barton
- From: Daniel Barton [mailto:[EMAIL PROTECTED]] Sent: 28 November 2001 4:14 PM To: Martin E. Koss Subject: Re: [PHP-DB] JOIN - Not working. Try: select sum(if(whatever=whatever,1,0)) as whatever from wherever where whatever=whatever; This is a pretty fast command for simple cross

RE: [PHP-DB] JOIN operations

2001-11-12 Thread Rick Emery
There isn't the field table_name.ID_city!!! because you didn't ask for it. You asked for: table_name.name table_city.ID table_city.city -Original Message- From: Carlo Loiudice [mailto:[EMAIL PROTECTED]] Sent: Friday, November 09, 2001 4:02 PM To: PHP DB Subject: [PHP-DB] JOIN

RE: [PHP-DB] JOIN operations

2001-11-09 Thread Gonzalez, Lorenzo
select n.name, c.city, c.ID from table_name n, table_city c where c.ID = n.ID_city No sweat. -Lorenzo -Original Message- From: Carlo Loiudice Sent: Fri 11/9/2001 5:01 PM To: PHP DB Cc: Subject: [PHP-DB] JOIN

RE: [PHP-DB] Join Sentences

2001-02-09 Thread Gaby
http://www.atrivia.com - Original Message - From: Jorge Santos [EMAIL PROTECTED] To: Gaby [EMAIL PROTECTED] Cc: PHP-DB [EMAIL PROTECTED] Sent: Friday, February 09, 2001 2:17 PM Subject: Re: [PHP-DB] Join Sentences Hi Gaby, Your best bet is to probably place the statements you want