我有两张桌子
tbl_a
extension UIView {
public class func instantiateViewFromNib<T>(_ nibName: String, inBundle bundle: Bundle = Bundle.main) -> T? {
if let objects = bundle.loadNibNamed(nibName, owner: nil) {
for object in objects {
if let object = object as? T {
return object
}
}
}
return nil
}
}
tbl_b
VBID | KBID | SEQ
4 | 5 | 1
4 | 6 | 2
5 | 6 | 1
5 | 8 | 2
到目前为止我得到的是
VBID | more columns to be used
4 | bar
5 | foo
我得到的结果是
SELECT
tbl_b.VBID,
tbl_a_a.KBID,
tbl_a_b.KBID
FROM (tbl_b
INNER JOIN tbl_a AS tbl_a_a ON tbl_b.VBID = tbl_a_a.VBID)
INNER JOIN tbl_a AS tbl_a_b ON tbl_b.VBID = tbl_a_b.VBID
WHERE tbl_a_a.KBID <> tbl_a_b.KBID;
我不需要第二行(或第一行),因为它代表相同的数据,我必须在查询中更改为仅接收1行 更复杂的是我使用的是ACCESS
答案 0 :(得分:1)
如果你想要哪一个并不重要:
protected void Button1_Click(object sender, EventArgs e)
{
string username1 = uniloginTextBox.Text;
string password1 = passwordTextBox.Text;
using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, "cv.local"))
{
// validate the credentials
bool isValid = pc.ValidateCredentials(username1, password1, ContextOptions.Negotiate);
}
if (IsValid == true)
{
Label.Text = "approved";
}
else if (IsValid == false)
{
Label.Text = "Denied";
}
答案 1 :(得分:1)
添加一个条件
SELECT
tbl_b.VBID,
tbl_a_a.KBID,
tbl_a_b.KBID
FROM (tbl_b
INNER JOIN tbl_a AS tbl_a_a ON tbl_b.VBID = tbl_a_a.VBID)
INNER JOIN tbl_a AS tbl_a_b ON tbl_b.VBID = tbl_a_b.VBID
WHERE tbl_a_a.KBID < tbl_a_b.KBID;
答案 2 :(得分:0)
将您的WHERE
条款更改为:
WHERE tbl_a_a.KBID < tbl_a_b.KBID;