如何获取不在不同表colum中的值

时间:2016-03-20 14:00:47

标签: mysql

我正在努力让我的查询在不同的表列HomeTeam和AwayTeam中查找TeamCode,如果AwayTeam或HomeTeam在HomeTeam或AwayTeam中没有35,则返回Team列。

此代码仅查找匹配表中不存在的TeamCode,我需要这样做,它只显示35不存在的行。

SELECT  Team
FROM    club
WHERE   TeamCode NOT    IN  (SELECT DISTINCT    
HomeTeam FROM   matches);   

1 个答案:

答案 0 :(得分:1)

我不知道您希望哪个列与35不同,但要将其更改为所需的列名称:

'use strict';

var obj = [{'id': 0, 'review': 'Test1', 'author': 'Bob1'},{'id': 1, 'review': 'Test2', 'author': 'Bob2'},{'id': 2, 'review': 'Test3', 'author': 'Bob3'}];

$(function () {
            var html = '';
            var first = true;
            $.each(obj, function (i, v) {        
                html += '<div id="review_' + i + '" class="review ' + (first ? '' : 'hide') + '">';
                html += '<p>' + v.review + '</p>';
                html += '<p class="small">' + v.author + '</p>';
                html += '</div>';
                first = false;
            })
            $('#review_container').html(html);
            cycleReviews(0);

    var t_out;

    function cycleReviews(idx) {
        clearTimeout(t_out);
        t_out = setTimeout(function () {
            console.log(idx)
            if(idx == obj.length) {
                    console.log('reload')
                    idx = 0;
            }
            $('.review').animate({opacity: '0'}, function () {
                $('.review').addClass('hide');
                $('#review_'+ (idx)).css('opacity', '0.0').removeClass('hide').animate({opacity: '1.0'});                
                cycleReviews(idx+1);
            });


        }, 2000);
    }
});

或不存在:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container text-center home-2">
                    <h1 class="hero">Customer Reviews</h1>
                    <div class="bullets"><span id="bullet_1">&#8226;</span> <span id="bullet_2">&#9702;</span> <span id="bullet_3">&#9702;</span></div>
                    <div id="review_container">
                    </div>
                    <p class="green">A happy client</p>
                </div>