SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Port Sunlight
    Posts
    815
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    LEFT JOIN and WHERE

    I have the following query:

    PHP Code:
    SELECT a.article_ida.titlea.texta.picturea.topic_iddate_format(a.pub_date,' %D %M %Y') as pub_dateCOUNT(c.article_id) AS total
    FROM articles a LEFT JOIN comments c ON a
    .article_id c.article_id
    GROUP BY a
    .article_ida.titlea.texta.topic_idpub_date 
    What I want to do is also show articles via a topic_id URL parameter.

    So before it worked with this query:

    PHP Code:
    SELECT *
    FROM articles
    WHERE topic_id 
    colname 
    The first query shows the article with the comments total, the second just shows the article via the topic_id.

    I want to be able to show the article via the topic_id with the correct number of comments.

    Any ideas?

  2. #2
    $this->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Dec 2003
    Location
    Federal Way, Washington (USA)
    Posts
    1,524
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You might want to post this in the MySQL forum or ask a moderator to move it there for you.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    Showcase your music collection on the Web


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •