作者sun3star (Boriska)
看板Database
標題[問題] 在三個關聯資料表中使用select (sql)
時間Wed Aug 23 00:30:15 2006
我的資料庫中有三個資料表
分別是
Programs
﹂p_id
﹂p_title
Units
﹂p_id ←跟Programs的 p_id 關聯
﹂u_id
﹂u_title
Lessons
﹂p_id ←跟Programs的 p_id 關聯
﹂u_id ←跟Units的 u_id 關聯
﹂l_id
﹂l_title
我想要使用select 去找Programs資料表的資料
set rs=server.createobject("adodb.recordset")
rs.open "select * from programs where p_id = '" & PID & "'", cn, 1, 1
(PID是我的變數)
但是這樣用select它就說有問題, 找不到我要的資料
當我只"select * from programs", cn, 1, 1
沒有where的時候就可以
難道有關聯的資料表不能用條件去select?
--
「小孩怎會不喜歡腳踏車?它是你的第一部車,代表著獨立與自由。
騎上單車,你可以盡情奔馳,規則、大人都管不了你。」
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.122.214.51
※ 編輯: sun3star 來自: 140.122.214.51 (08/23 00:30)
1F:推 foxzgerald:建議你把查詢字串 print out 出來看看 08/23 23:44