考虑到primary key为id,但查询条件是姓名,要考虑同名的情况。该如何写?

解决方案 »

  1.   

    select * from t_player   where name=' 你要的名字 '   就OK了,还要什么?
      

  2.   

    select * from t_player   where id=
      

  3.   

    回caiyunxia(monkey) :我把那句话直接复制过来了,不好意思,球员和教练分两个表。这是球员表,作为示范,球员的存储过程搞好教练的自然也就好了。
    回linzhisong(無聊) ( ) ,caiyunxia(monkey) ( ):但现在是要做成存储过程,然后在应用程序中调用本过程,返回结果在应用程序中处理。
      

  4.   

    select * from t_player   where name='姓名'
    这么简单的就不用做成存储过程了吧?存储过程就这样:
    create procedure aa @sname varchar(20)
    as 
    select * from t_player   where name=@sname
      

  5.   

    调用:
    declare @name varchar(20)
    select @name='李明'
    exec aa @name