STored Procedure / SQL Problem.

Results 1 to 2 of 2

Thread: STored Procedure / SQL Problem.

  1. #1
    Join Date
    Dec 1969

    Default STored Procedure / SQL Problem.

    I have 2 tables one called books and another called book marks. the common element in both is Book_id What i want to do is write a stored procedure that returns the books telling me if they are bookmarked or not. If i make 2 seperate calls to the database i can get the Bookmarked books. (An inner join over book_id) but how would i get the books that aren&#039t bookmarked?<BR><BR>Does anyone have any suggestions?

  2. #2
    Nathen Grass Guest

    Default RE: STored Procedure / SQL Problem.

    You can use a subquery to get the books that are not bookmarked:<BR><BR>SELECT Book_ID<BR>FROM Books<BR>WHERE Book_ID NOT IN<BR>(<BR>SELECT Book_ID<BR>FROM BookMarks<BR>)<BR><BR>That should do it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts