in reply to Re: Dereferencing nested references
in thread Dereferencing nested references

Mainly I wasn't using a JOIN because I haven't done much database work, and am not familiar with all that can be done with SQL calls. After breaking down your statement I can see where it would be very efficient, unfortunately in my case the second table may not have any data when I make the calls, and I still need to return the info from the first table regardless. It looks to me like this statement will return "all or nothing." Is this true?

ryddler
  • Comment on Re: Re: Dereferencing nested references

Replies are listed 'Best First'.
Re: Re: Re: Dereferencing nested references
by jeroenes (Priest) on Jan 16, 2001 at 20:20 UTC
    ryddler, you'll just have to ponder SQL a little bit harder. Because, you can make outer joins as well. Generally:
    SELECT name, 'In table2!' FROM table1 WHERE ID IN (SELECT ID FROM table2) JOIN SELECT name, 'Not in table2!' FROM table1 WHERE NOT ID IN (SELECT ID FROM table2);
    Well, this isn't beautiful SQL either, as you write two subselects, but it gets the job done. Whatever the columns and order in which you want it be returned, it really can be done in SQL. Look here for a tutorial.

    Jeroen
    "We are not alone"(FZ)