elmpp Posted September 24, 2003 Share Posted September 24, 2003 I have this question to answer as part of a job application, so i would be very grateful if i could get some help!! The question in question is number 2c at this link: http://www.freecaradverts.com/red_snapper_test.pdf I know this is a bit cheeky, but I\'m desparate to get this done. Is this possible within MySQL (i\'m trying it with that). I\'ve tried comparing the tables with an if(SUBSCRIPTION.paperid=PAPER.paperid, \'True\', \'False\') but can\'t seem to just get the 5 returned rows. Help!!!!!!!!!!!! :x Quote Link to comment Share on other sites More sharing options...
gizmola Posted September 25, 2003 Share Posted September 25, 2003 select papername, IF(personid is null,\'False\', \'True\') as subscribed from paper left outer join subscription on paper.paperid=subscription.paperid and subscription.personid =1 order by papername The important things: -use left outer join to get a row whether or not Jacque is subscribed -use AND to only get rows from subscription that are Jacque (personid =1). Since a person can only be subscribed to a paper once, this means that we either get a personid of 1, or NULL in the personid column. -use IF on personid to test for NULL (ie a paper that Jacque is not a subscriber to) Don\'t say I never did anything for ya :wink: Now if you get the job, will I be getting a kickback from you? Quote Link to comment Share on other sites More sharing options...
elmpp Posted September 25, 2003 Author Share Posted September 25, 2003 Thanks v. much. That means my application is finished. If i get that job I\'ll... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.