Jump to content


Photo

simple query help [solved]


  • Please log in to reply
3 replies to this topic

#1 digitalgod

digitalgod
  • Members
  • PipPipPip
  • Advanced Member
  • 374 posts

Posted 10 July 2006 - 11:59 PM

I'm trying to display everything in 1 table that's not in another table.

<?php
$sql='SELECT * FROM djs WHERE name NOT
?>

I need to select all the djs from the djs table that are not in the djsweek table... how can I do that?

#2 mrome

mrome
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 11 July 2006 - 12:06 AM

Would have been a bit more help if you gave us the the columns of both tables. This will get u started.

SELECT *
FROM djs
WHERE NOT EXISTS
(

SELECT *
FROM djsweek
WHERE djsweek.name = djs.name

)



#3 digitalgod

digitalgod
  • Members
  • PipPipPip
  • Advanced Member
  • 374 posts

Posted 11 July 2006 - 12:17 AM

I tried that but it gave me an error....

the columns of both tables match but I just need to check the names

#4 digitalgod

digitalgod
  • Members
  • PipPipPip
  • Advanced Member
  • 374 posts

Posted 11 July 2006 - 12:32 AM

nevermind my bad, had a 'name' too many in there

thanks!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users