Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Showing two different values in same program

Author  Topic 

omega1983
Starting Member

40 Posts

Posted - 2010-01-07 : 16:48:35
@beginDate
@endDate


select giftid,giftdate,amount
from gifts
where
giftdate >= @beginDate
and giftdate <= @endDate
/* this limits the pull those who gave in a prescribed date range*/

/*Lets say I also want to show an indicator if the person who gave is doing so for the first time. In other words I want to also know if a person gave prior to the @beginDate or <=@beginDate. How can I show this on the same stored procedure or will I need a separate one

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-01-07 : 16:54:36
Which version of SQL Server?
I can see no columns to retrieve data for a particular person...


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-01-08 : 02:07:32
where is the person info? i cant see it in posted query. which table you've person related fields?
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-01-08 : 02:16:30
quote:
Lets say I also want to show an indicator if the person who gave is doing so for the first time

You have to handle this in your application. Store the indicator somewhere then the person / user has perform something. These information is not available in SQL Server

quote:
I want to also know if a person gave prior to the @beginDate or <=@beginDate

Again, it is the job of your application to do that.

quote:
How can I show this on the same stored procedure or will I need a separate one

You need to have the information first before able to show it in your query


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -