SQL Statement

Results 1 to 2 of 2

Thread: SQL Statement

  1. #1
    Join Date
    Dec 1969

    Default SQL Statement

    Hello,<BR><BR>I&#039;m confused writing this sql statment, anyone lend a hand?<BR><BR>It&#039;s for a prescription program, I&#039;m trying to rely more on SQL than the ASP, to cut down on the load.<BR><BR>Table Info:<BR><BR>dependants<BR>-first<BR>-last<BR>-socialsecurity<BR>(and others)<BR><BR>employees<BR>-first<BR>-last<BR>-socialsecurity<BR>(and others)<BR><BR>prescriptions<BR>-pharmacy<BR>-drugname<BR>-brandtype<BR>-copay<BR>-grosscost<BR>-filldate<BR>-socialsecurity<BR>(and others)<BR><BR>How do i pull up the info out of the prescriptions table, as well as the name that matches the social security number (out of either employee or dependants table)? I can get it to work for one of the two tables with an inner join, and it works nice. But I can&#039;t get it to work with both.<BR><BR>Thanks for the help!<BR>Andy<BR>prescrip<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: SQL Statement

    &nbsp;<BR>select d.First as depFirst,<BR> d.Last as depLast,<BR> e.First as empFirst,<BR> e.Last as empLast,<BR> p.pharmacy,<BR> p.drugname,<BR> p.socialsecurity <BR> from prescriptions p<BR> LEFT OUTER JOIN ON Employee emp<BR> (p.socialsecurity = emp.socialsecurity)<BR> LEFT OUTER JOIN ON Dependents dep<BR> (p.socialsecurity = dep.socialsecurity)<BR> where p.socialsecurity = &#039;123-45-6789&#039;

Posting Permissions

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