select store_name from store_information where country is null union select store_name frOm store_information where country='USA';
执行正常
select store_name from store_information where country is null minus select store_name frOm store_information where country='USA';
显示Incorrect syntax near 'minus'.
求原因

解决方案 »

  1.   

     
     (select store_name from store_information where country is null )
      minus 
    (select store_name frOm store_information where country='USA')
      

  2.   

    MINUS 指令是運用在兩個 SQL 語句上。它先找出第一個 SQL 語句所產生的結果,然後看這些結果有沒有在第二個 SQL 語句的結果中。如果有的話,那這一筆資料就被去除,而不會在最後的結果中出現。如果第二個 SQL 語句所產生的結果並沒有存在於第一個 SQL 語句所產生的結果內,那這筆資料就被拋棄。/**
     *问题原因可能是表结构不同或者数据库不支持这个指令
     */
      

  3.   

     select store_name frOm store_information where country='USA'
      minus 
    select store_name from store_information where country is null 
      

  4.   

    select store_name from store_information minus select store_name from store_information where sales=390;
    执行时候将两个select分别执行出两个结果。。
      

  5.   

    嗯,sql server没有minus,明白了