PDA

View Full Version : getting records from 2 tables


madg3rr
06-20-2003, 03:26 AM
my qns dis time will not be too complicating i hope...
Anywae i wanna take records from 2 tables using the sql method so how do i go abt writing my sql statement?

tables : info & process
primary key : id

if from one table, i noe its,
" select * from info where ID='" & id &"' "

so if from 2 tables how?

chinnababu
06-20-2003, 06:21 AM
sqlA = "select * from info where ID='" & id &"'"
sqlB = "select * from process where ID='" & id &"'"

and create two different recordsets.
set rsGetSqlA = server.createobject("adodb.recordset")
set rsGetSqlB = server.createobject("adodb.recordset")

jsawkang
06-20-2003, 07:20 AM
Hi...
u can use this method. online using 1 sql query.

SQL="Select info.*, process.* from info, process WHERE info.ID='" & id &"' AND info.ID=process.ID"
set rs=cn.execute(SQL)