SQL Statement

Results 1 to 9 of 9

Thread: SQL Statement

  1. #1
    Join Date
    Dec 1969
    Posts
    11

    Default SQL Statement

    Trying to return data from two tables only returning from tblnewsletter the idadvisor variables are the same in both tables.<BR><BR>set rs=con.execute("select * from Tbladvisor_bio A, tblnewsletter P where A.idadvisor=P.idadvisor and P.sessionid= " & session("sessionid"))<BR><BR>cant figure it out...<BR>Thanks,<BR>George

  2. #2
    Join Date
    Dec 1969
    Posts
    7,686

    Default RE: SQL Statement

    Seems correct to me, what is the problem?

  3. #3
    Join Date
    Dec 1969
    Posts
    11

    Default RE: SQL Statement

    Its only returning the data from tblnewsletter, I thought it was correct too but it doesnt seem to be working, I can response.write rs("bio") "a field in tblAdvisor_bio" and nothing is returned.

  4. #4
    Join Date
    Dec 1969
    Posts
    7,686

    Default RE: SQL Statement

    What happens when you execute the same query in the Query designer (Access) or Query Analyzer (SQL Server)?<BR><BR>Do you get the expected results?


  5. #5
    Join Date
    Dec 1969
    Posts
    11

    Default RE: SQL Statement

    no, returns null

  6. #6
    Join Date
    Dec 1969
    Posts
    7,686

    Default RE: SQL Statement

    Did you take out the &#039;AND P.SessionId&#039; part?<BR><BR>Execute the following query:<BR><BR><BR>Select * from Tbladvisor_bio A, tblnewsletter P where A.idadvisor=P.idadvisor<BR><BR>

  7. #7
    Join Date
    Dec 1969
    Posts
    11

    Default RE: SQL Statement

    That returns all records where idadvisor=idadvisor in both tables.

  8. #8
    Join Date
    Dec 1969
    Posts
    7,686

    Default RE: SQL Statement

    Ok, so that works. Now we need to find out why it doesn&#039;t work in the ASP page.<BR><BR>Does session("sessionid")) have a value?

  9. #9
    Join Date
    Dec 1969
    Posts
    11

    Default RE: SQL Statement

    yes, when I debugged I wrote it out.

Posting Permissions

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