sql

Results 1 to 2 of 2

Thread: sql

  1. #1
    virang Guest

    Default sql

    how to write sql statement for asp that uses two different tables and join them on some key.<BR><BR>my query is as below :<BR>select S.SUBCLASS_NAME, C.CLASS_NAME<BR>from SUBCLASS S, CLASS C<BR>where S.CLASS_ID = C.CLASS_ID;<BR><BR>i want to try the same query for my asp. how can i?

  2. #2
    Join Date
    Dec 1969
    Posts
    131

    Default RE: sql

    You can do the following in asp.......<BR><BR>MYDSN="DSN=dsnname;UID=;PWD=;" &#039set dsn <BR>set DbObj = server.createobject("ADODB.Connection")<BR>DbObj.o pen MyDSN<BR><BR>SQLgetclass="SELECT s.subclass_name, c.class_name FROM tbltable1 s, tbltable2 c WHERE s.subclass_name = c.class_name"<BR> <BR>set Rs=DbObj.execute(SQLgetclass)<BR>response.write SQLgetclass &#039lets you see what SQL returns. You can comment this part out once you&#039ve seen that query is executing correctly.<BR><BR>I would hope that these two tables (table s and table c) are joined on a numeric value(eg ID) and not a text field (name). <BR><BR>I hope this help.<BR>

Posting Permissions

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