I have two tables in a database:
Table 1 - files:
column 1 - ID
column 2 - deleted
Table 2 - seminar_files
column 1- seminar_id
column 2 - file_id
ID from table 1 and file_id from table 2 are the column that bridges these together. So for example, I may have a file with an ID of "hakurocks" in table 1, and that same 'hakurocks' may appear in table 2. It may appear zero times, one time or many times, but will have a different seminar_id for each time it appears.
I want to select all the IDs from from table 1 that aren't in table 2 when seminar_id is equal to 18 (for example). On top of this, I only want to select the files from table one where deleted is set to zero.
Anybody got an idea on how to put together this mysql query? I've tried a bunch of different ways, and I either end up with ALL the files from table one, or none!
Difficult MYSQL query
Whether you're a seasoned veteran or a struggling beginner, Web Radiance is the web development and web design forum for you. You'll find answers to all your HTML, CSS, SEO, and Programming needs. Pull up a chair and stay awhile.
Page 1 of 1
Difficult MYSQL query
#1
Posted 28 January 2008 - 11:05 AM
<a href="http://www.jaypan.com" target="_blank">Jaypan</a>
<a href="http://www.dudes-japan.com" target="_blank">Dudes Japan</a>
<a href="http://www.dudes-japan.com" target="_blank">Dudes Japan</a>
#2
Posted 28 January 2008 - 04:31 PM
Can you send me a dump of those tables so I can test my query before posting it? You can attach it to a PM if you want.
#3
Posted 28 January 2008 - 06:43 PM
Heh, are you asking me to take a dump and send it to you? 
I think some guy gave me an answer on another forum. I'll try it out and if it doesn't work I'll do that. Thanks though, I really do appreciate the willingness to help!
I think some guy gave me an answer on another forum. I'll try it out and if it doesn't work I'll do that. Thanks though, I really do appreciate the willingness to help!
<a href="http://www.jaypan.com" target="_blank">Jaypan</a>
<a href="http://www.dudes-japan.com" target="_blank">Dudes Japan</a>
<a href="http://www.dudes-japan.com" target="_blank">Dudes Japan</a>
#4
Posted 01 February 2009 - 05:01 AM
select from table
table should not be between brackets.
if your table name is a variable then it should be '$ticket' instead of 'ticket', but i dont think its the case so just remove the brackets surrounding your table name.
hope this helps
table should not be between brackets.
if your table name is a variable then it should be '$ticket' instead of 'ticket', but i dont think its the case so just remove the brackets surrounding your table name.
hope this helps
Buy SSL certificates today and secure your website.
#5
Posted 02 February 2009 - 12:43 AM
Are you reading a different thread than me?
<a href="http://www.jaypan.com" target="_blank">Jaypan</a>
<a href="http://www.dudes-japan.com" target="_blank">Dudes Japan</a>
<a href="http://www.dudes-japan.com" target="_blank">Dudes Japan</a>
Share this topic:
Page 1 of 1


Help
This topic is locked

MultiQuote









