select count(*) from northwind..employees where age>50

解决方案 »

  1.   

    更正:
    select count(*) from northwind..employees where datediff(year,birthdate,getdate())>50
      

  2.   

    CREATE PROCEDURE ecount
    @count int out
    AS
    select @count=count(*) from employees where datediff(yy,birthdate,getdate())>50
    GO
      

  3.   

    CREATE PROCEDURE ecount
    AS
    select count(*) from employees where datediff(yy,birthdate,getdate())>50
    GO
      

  4.   

    create proc 名
    as
    select count(*) 数量 from northwind..employees where datediff(year,birthdate,getdate())>50
      

  5.   

    getdate后面跟着的()是什么意思啊
      

  6.   

    --那是格式
    select getDate()
      

  7.   

    select count(*) 数量 from northwind..employees 
    ------^^^^^^^^^如果没有的话那它就返回0
    where datediff(year,birthdate,getdate())>50
      

  8.   

    declare @sum int
    select @sum=count(*) from 作者表
    where datediff(yy,出生日期,getdate())>50
    if @sum<>0
       print @sum
    else
       print 0