Hard SQL question

Results 1 to 2 of 2

Thread: Hard SQL question

  1. #1
    Robert Liberman Guest

    Default Hard SQL question

    Hi all,<BR><BR>I am trying to write SQL stored procedure that returns data from two related tables, the problem is I end up creating SQL statment with two joints on itself. Here is what I am trying to do: User enters a search string-&#062;database dictionary table is searched and corresponding terms are returned with their descriptions-&#062;the querry should also return data from a relationship table, where related terms are stored.<BR><BR>Here are my tables:<BR><BR>Dictionary table<BR>d_id,<BR>d_title,<BR>d_description<BR><BR ><BR>Relationship table<BR>d_id,<BR>r_id<BR><BR>Dictionary.d_id = Relationship.d_id <BR>Dictionary.d_id = Relationship.r_id<BR><BR>I am stuck! Please help.<BR><BR>Many thanks,<BR>Robert<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Hard SQL question

    Not 100% for sure without seeing full db model, but this should give you a building block...<BR><BR>SELECT d.d_id, d.d_title, d.d_description, r.r_id FROM Dictionary d, Relationship r WHERE d.d_title LIKE &#039%" & UserSearchString & "%&#039 AND d.d_id = r.d_id "<BR><BR>HTH<BR><BR>Jerry

Posting Permissions

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