Multiple table <SELECT>'s

Results 1 to 3 of 3

Thread: Multiple table <SELECT>'s

  1. #1
    Keith Solomon Guest

    Default Multiple table <SELECT>'s

    Here&#039s what I am trying to do. I have 2 tables, call them Member Info and Codes. Member Info has a field that contains codes that are defined in the Codes table. What I want to do is fill a &#060;select&#062; from the Codes table (done), and have it show the definition for the code in the current record. I have tried everything I can think of to make this work this way, but I have hit a wall. Any help would be appreciated.

  2. #2
    Cable Guest

    Default RE: Multiple table <SELECT>'s

    Does your code look something like this?<BR><BR>&#060;%<BR>Set Connection = Server.CreateObject("ADODB.Connection")<BR><BR>Con nection.ConnectionTimeout = 60<BR>Connection.CommandTimeout = 60<BR><BR>Connection.Open "DSN=db_pgm; UID=sa"<BR><BR>SQLStmt = "Select code, description from db_pgm..codes Order By Description"<BR><BR>Set RS = Connection.Execute(SQLStmt)<BR>%&#062;<BR><BR>&#06 0;select name="cbo_code" size="1"&#062;<BR>&#060;option value="0"&#062; &#060;/option&#062;<BR>Do While NOT RS.EOF<BR>%&#062;<BR>&#060;option value="&#060;%=RS("code")%&#062;"&#062;&#060;%=UCa se(RS("description"))%&#062;&#060;/option&#062;<BR>&#060;%<BR>RS.MoveNext<BR>Loop <BR>%&#062; <BR><BR>The Value= is the result sent back to your receiving ASP page, the user just sees the description but the ASP page sees the value of the code that connections to the description.<BR>Change this code to use the database, table names, and field names that you use. <BR><BR>--------------------------------------------------------------------------------<BR> <BR>

  3. #3
    Alain Moran Guest

    Default RE: Multiple table <SELECT>'s

    Alternativley, you could modify your original SELECT statemant to present a &#039VIEW&#039 to the tables<BR><BR>eg<BR><BR>SELECT dbo.MemberInfo.Field1, dbo.MemberInfo.Field2, ... dbo.Codes.Description FROM dbo.MemberInfo, dbo.Codes WHERE dbo.MemerInfo.CodeField=dbo.Codes.CodeKeyField<BR> <BR>Obviously you dont include the CodeField in the first list (ie what&#039s being displayed), but you do want the description ...<BR><BR>I think that is acutally doing the same thing as the other solution, but except that mine does it using SQL rather than ASP.<BR><BR><BR>Hope that helps<BR><BR>Al.<BR><BR>Check out this URL :: http://w3.one.net/~jhoffman/sqltut.htm

Posting Permissions

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