Problem with query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anju07
    New Member
    • May 2007
    • 12

    Problem with query

    hi,

    I have a drop-down box whereever a name is to be entered so that a user can select a name from that.
    I have to store the userid, but display the username.
    While display, i am able to display the username, but in this particular form, where i have to display the username's of two columns: responsibility and chairperson,i am unable to write the query.How can it be written?

    Below ive pasted the query which displays the username for column:responsi bility, i want to display the username for both the columns

    rs = st.executeQuery ("select u.username,a.to befollowedupby from table2 a,table1 u WHERE a.responsibilit y=u.userid");

    Below, are the tables
    Table 1: userid,username
    Table 2: responsibility, chairperson


    --------------------------------------------------------------------------------
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    I dont think there is any relation ship between these two tables

    and your query

    "select u.username,a.to befollowedupby from table2 a,table1 u WHERE a.responsibilit y=u.userid"

    may not work.

    beacuse it seems responsbility and userid columns must have different data type ,then how can u match on these two fields.

    Comment

    • gangadharampidugu
      New Member
      • May 2007
      • 5

      #3
      Originally posted by anju07
      hi,

      I have a drop-down box whereever a name is to be entered so that a user can select a name from that.
      I have to store the userid, but display the username.
      While display, i am able to display the username, but in this particular form, where i have to display the username's of two columns: responsibility and chairperson,i am unable to write the query.How can it be written?

      Below ive pasted the query which displays the username for column:responsi bility, i want to display the username for both the columns

      rs = st.executeQuery ("select u.username,a.to befollowedupby from table2 a,table1 u WHERE a.responsibilit y=u.userid");

      Below, are the tables
      Table 1: userid,username
      Table 2: responsibility, chairperson


      --------------------------------------------------------------------------------
      Hi,
      i hope it may work well and help u.
      select u.username responsibility, b.username chairperson
      from table1 u,table1 b,table2 a
      where u.userid = a.responsibilit y
      and b.userid = a.chairperson

      regards,
      gangadhar

      Comment

      Working...