SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot kamm's Avatar
    Join Date
    Nov 2003
    Location
    Espaņa
    Posts
    162
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    2 queries or one..?

    This is for a detail page...

    properties:
    ------------
    propID
    propName
    price
    description
    etc...

    propTypes:
    ------------
    propID
    propType

    Which is better...

    SELECT
    p.propID,
    propName,
    price,
    description
    FROM
    properties p
    LEFT JOIN propTypes pt ON p.propID = pt.propID
    WHERE
    p.propID = 1234

    >>> or just do two queries (WHERE propID = 1234)?

  2. #2
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    either is OK, but if you're asking which is faster, you will need to do some testing to answer that yourself.

  3. #3
    SitePoint Zealot kamm's Avatar
    Join Date
    Nov 2003
    Location
    Espaņa
    Posts
    162
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cheers... I'm not too worried about speed, just wondered if one was more "correct" than the other...


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
  •