是不是不能两个表联合查询啊?你先整个简单的两表连接,如 select a.* , b.* from a,b where a.id = b.id如果成功,就是你的查询语句错了.

解决方案 »

  1.   

    注意区分一下系统里面的语句  FROM  User   改成 FROM [User]  看看是不是这个问题
      

  2.   

    user--关健字加上[]--用not in少一次嵌套
    SELECT       
    TOP       2       
    [User].id,       
    UserProfiles.User_serId   
    FROM       
    [User]   a     
    INNER       JOIN   
    UserProfiles  b     ON       a.id       =       b.User_serId   
    WHERE       a.id not in 
    (SELECT       TOP       2       [User].id   FROM       [User], UserProfiles   
    WHERE       [User].id       =   [UserProfiles].User_serId   
    ORDER       BY       [User].id   ASC)  
      
    ORDER       BY       a.id   
      

  3.   

    SELECT       
    TOP       2       
    a.id,       
    b.User_serId   
    FROM       
    [User]   a     
    INNER       JOIN   
    UserProfiles  b     ON       a.id       =       b.User_serId   
    WHERE       a.id not in 
    (SELECT       
    TOP       2    
    [User].id   
    FROM       
    [User], UserProfiles   
    WHERE       [User].id       =   [UserProfiles].User_serId   
    ORDER       BY       [User].id   ASC)  
      
    ORDER       BY       a.id