PDA

View Full Version : Problems with Output


luigicannavaro
12-08-2008, 08:59 AM
Hi

Could you please give me some feedback to solve this problem?

For example: I have a table with 2 fields: ID and names. and anotther table with 1 field: fileID.

Rs.open "select * from table1, table2 where id=fileid and names like '%"& keywords & "%' "conn

Table1

ID Names
1 Economics
1 is
1 a
2 pathbreaking
2 journal
2 that
2 captures
3 the
3 advantages

Table2

FileID

1
2
3



Question: How I do to see

1. all records from tableA that match with names like '%"& keywords & "%' MORE the restriction I put: id=fileid, BUT that not shows the ID=FILE where there is not any MATCH!

2. How I show all names with same ID?

Best regards

Luigi Cannavaro

SouthwaterDave
12-08-2008, 09:11 AM
You need an inner join in you query:rs.Open _
"select * from table1 inner join table2 on id = fileid and names like '%" & _
keywords & "%' ", conn

luigicannavaro
12-08-2008, 09:37 AM
The code makes sense, but it does the following answer:

Join expression not supported.

Do you know Why?

Luigi

SouthwaterDave
12-08-2008, 11:51 AM
I think I got the join wrong. Try this:rs.Open _
"select * from table1 " & _
"inner join table2 on table1.id = table2.fileid " & _
"where table1.names like '%" & keywords & "%' ", conn

luigicannavaro
12-08-2008, 12:23 PM
Thanks for your feedback.

It would working... but not works. The problem is related to:

table1.names like '%" & keywords & "%'

I think there is a mistake in my .html file that open this .asp file.

Thanks again.

Luigi

luigicannavaro
12-09-2008, 07:30 AM
Ok. I found a solution using insert + select.

Thanks

Luigi;)