Jump to content


Photo

mysql SELECT Query help


  • Please log in to reply
1 reply to this topic

#1 phporcaffeine

phporcaffeine
  • Members
  • PipPipPip
  • Advanced Member
  • 361 posts
  • LocationOhio, USA

Posted 22 August 2006 - 03:05 PM

2 tables, 1 database

Database: 'breakdown'

Table 1: record

Table 2: notify


    When record is inserted into table 'record' an entry is made in table 'notify', with table 'record' 's auto?_number.

    I want to SELECT FROM record WHERE col='mydata' AND FROM notify WHERE col='mydata'.  I know that isn't the right syntax but hopefully you get what I am tryig to do.  I am trying to select a row based on a single value existing in 2 different columns, in 2 different tables.


TIA

Thanks,

Ryan Huff
President & Founder, MyCodeTree
support@mycodetree.com | http://mycodetree.com

#2 ShogunWarrior

ShogunWarrior
  • Members
  • PipPipPip
  • Advanced Member
  • 528 posts
  • LocationIreland

Posted 22 August 2006 - 03:25 PM

SELECT * FROM record LEFT JOIN notify ON notify.col = record.col WHERE record.col = 'mydata';
<a href="http://www.daviddora...nmedia.com/">My New Site/Blog</a> | <a href="http://www.daviddora...m/check/">Check your page for broken links/images/scripts</a>

Zend Certified Engineer
Follow me on Twitter: http://twitter.com/davidd




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users