2013-08-17 66 views
0

我有主表通道,其具有的所有通道(這個大表有所有通道) 我有另一個表user_channel其中只有該用戶渠道(僅此用戶渠道)語法select語句vb.net

我需要從(表格頻道)中獲取不存在於此特定用戶頻道列表中的所有頻道。

我試過,但沒用:

SELECT channel from channels where NOT EXISTS 
(SELECT channel FROM user_channels WHERE 
User_channel.user_name=’& Me.DataGridView_user_update.CurrentRow.Cells(0).Value.ToString &’」 And  
channels.channel_name = user_channels.channel_name) 
+0

我相信你錯過了一個*在第一個*符號*之前加雙引號*。 – Itay

回答

0
  • 你提的問題不夠清晰正確回答!
  • 使用表channelsprimary key columnuser_channels,所以不是user_channels.channel_name你應該有user_channels.primaryKeyColumnOfTableChannels

現在我覺得應該下方爲你工作:

SELECT channel from channels where NOT EXISTS 
(SELECT channel FROM user_channels WHERE 
User_channel.user_name='" & Me.DataGridView_user_update.CurrentRow.Cells(0).Value.ToString &」')