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
I am trying to pull data together from several tables. I have an sql query like:
now the g_code, l_code, c_code may be empty on one table, but not the otherPHP Code:SELECT * FROM tbl_w w, tbl_g g, tbl_c c, tbl_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'
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
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
Thanks for pointing me in the right direction - have some reading to do.
Follow Me | Looking for Merchants Who Do Scifi Stuff
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks