By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,442 Members | 1,485 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,442 IT Pros & Developers. It's quick & easy.

multiple records and tables query - help

P: n/a
Not sure if I should post in php or sql,

$query = "SELECT page.*, url_pages.* FROM `page` LEFT JOIN `keywords`
USING(`page_id`) LEFT JOIN URL_PAGES USING (`page_id`) WHERE
MATCH(`keywords`.`keyword_txt`) AGAINST ('$keyword'IN BOOLEAN MODE)";

I got a keyword table, the fulltext finds the word in the keywords table
and relates the page_id field to identical fields in the page table and
the url table.

keyword table
page_id keyword
1 foo

page table
page_id title description
1 my urls It' my webpage

url table
page_id url
1 goglle1.com
1 goglle2.com

I want *one reord* rendering like this:

my urls It' my webpage goglle1.com goglle2.com

ie. the user sees one record

BUT in my mysql/php attempts i get this rendering:
my urls It' my webpage goglle1.com
my urls It' my webpage goglle2.com

What's the strategy to combine into *one* record? I can split things up
into two separate querys? I need help. Thanks
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
leegold2 <le*****@nospam.net> wrote:
Not sure if I should post in php or sql,

$query = "SELECT page.*, url_pages.* FROM `page` LEFT JOIN `keywords`
USING(`page_id`) LEFT JOIN URL_PAGES USING (`page_id`) WHERE
MATCH(`keywords`.`keyword_txt`) AGAINST ('$keyword'IN BOOLEAN MODE)";
...
I want *one reord* rendering like this:

my urls It' my webpage goglle1.com goglle2.com

ie. the user sees one record

BUT in my mysql/php attempts i get this rendering:
my urls It' my webpage goglle1.com
my urls It' my webpage goglle2.com

What's the strategy to combine into *one* record? I can split things up
into two separate querys? I need help. Thanks


You can't do this with SQL. You will have to process the results in code.
Scan through the query results, accumulating the URL field, while watching
for the primary key field to change.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.