Results 1 to 3 of 3

 

Thread: Basic MYSQL that is bugging me

  1. #1
    thin[box]king

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Cambridge
    Posts
    1,905
    Thanks
    13
    Thanked 12 Times in 12 Posts


    I am trying to pull data together from several tables. I have an sql query like:

    PHP Code:
    SELECT FROM tbl_w wtbl_g gtbl_c ctbl_l l WHERE g.g_code w.g_code AND l.l_code w.l_code AND w.w_code 'VARIABLE DROPPED IN BY PHP' 
    now the g_code, l_code, c_code may be empty on one table, but not the other

    So i basically want to query to see if the codes match only where they are NOT EMPTY / NULL in one or both of the tables.

    Is there a simple fix to the SQL without having to write multiple queries

    I hope that this makes some sense
    Follow Me | Looking for Merchants Who Do Scifi Stuff

  2. #2
    Registered User

    Status
    Offline
    Join Date
    Oct 2003
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you need to check out the different join types - eg RIGHT JOIN, LEFT JOIN, INNER JOIN, OUTER JOIN and more....

    see MySQL AB :: MySQL 5.0 Reference Manual :: 11.2.7.1 JOIN Syntax
    and MySQL Essentials - Techotopia

  3. #3
    thin[box]king

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Cambridge
    Posts
    1,905
    Thanks
    13
    Thanked 12 Times in 12 Posts
    Thanks for pointing me in the right direction - have some reading to do.
    Follow Me | Looking for Merchants Who Do Scifi Stuff



Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Warning using reserved words in MySQL
    By DanielCoe in forum Programming
    Replies: 4
    Last Post: 21-07-05, 07:32 PM
  2. MYSQL loading
    By JohnC in forum Programming
    Replies: 1
    Last Post: 07-02-05, 02:02 PM
  3. Connect to MySql on a remote server?
    By accelerator in forum Programming
    Replies: 3
    Last Post: 07-01-05, 03:54 PM
  4. Anyone anygood with xml, php, mysql and Affiliate Window
    By AnnonnyMouse in forum Affiliate Marketing Lounge
    Replies: 1
    Last Post: 23-09-04, 11:00 AM

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
  •  
To Top

Content Relevant URLs by vBSEO 3.5.0 RC2