SQL Statement Help

Discussion in 'Databases' started by grobar, Aug 8, 2006.

  1. #1
    I have an SQL statement that selects all the distinct entries from a list that have a certain 'iParent' number, but I need to add in one parameter, and not sure how to go about it.

    Here is what I have so far...

    
    sqle = "SELECT DISTINCT ThreadParent, authoremail FROM la_FORUM_messages where ThreadParent=" & iParent & ""
    
    Code (markup):
    I need to add in something that says: BUT NOT including session("emailaddress")

    (entire query should read: select all unique email addresses from records with a specific parent id, EXCEPT for email address XXXXXXXXXXX
     
    grobar, Aug 8, 2006 IP
  2. dylanmills

    dylanmills Peon

    Messages:
    50
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try

    sql = "SELECT DISTINCT ThreadParent, authoremail FROM la_FORUM_messages where ThreadParent=" & iParent & " and EmailAddress <> '" & session("emailaddress") & "'"
    Code (markup):
     
    dylanmills, Aug 8, 2006 IP
    grobar likes this.
  3. grobar

    grobar Well-Known Member

    Messages:
    642
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    140
    #3
    That did'er first try. Take some rep. THanks.
     
    grobar, Aug 8, 2006 IP