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.
| Author |
Topic |
|
sqllearner
Aged Yak Warrior
639 Posts |
Posted - 2004-10-08 : 18:35:55
|
| Here the record is 2 and iam getting as 0 and if I remove the elected_plan <>'Y' then I will get 3.So please help me if the <> for a string check is wrong..DECLARE @plan intSELECT @plan=count(*)FROM tbl_plan_detailsWHERE payment_id = 5 AND CONVERT(varchar(8),date_of_pay,1) > CONVERT(varchar(8),getdate(),1) AND elected_plan <>'Y'PRINT @plan |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-10-08 : 18:40:19
|
| You haven't provided enough information. What do you want your query to do? Show us an example with data. elected_plan <> 'Y' just means show me the rows where elected_plan does not equal Y.Tara |
 |
|
|
sqllearner
Aged Yak Warrior
639 Posts |
Posted - 2004-10-08 : 18:44:32
|
| payment_id inc date_of_pay amount elected_plan 5 14 8/5/2004 100 NULL 5 15 9/5/2004 10 NULL 5 16 10/10/2004 20 Y 5 17 11/10/2004 30 NULL 5 18 11/12/2004 40 N |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-10-08 : 18:45:32
|
| So using this data, what result set do you want?Tara |
 |
|
|
sqllearner
Aged Yak Warrior
639 Posts |
Posted - 2004-10-08 : 18:45:52
|
| Sorry its payment_id,Inc,date_of_pay,amount and elected_plan and I want the records which are not equal to Y and which is greater than the current date |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-10-08 : 18:54:13
|
| SELECT count(*)FROM tbl_plan_detailsWHERE payment_id = 5 AND CONVERT(varchar(10),date_of_pay,101) > CONVERT(varchar(10),getdate(),101)AND (elected_plan <> 'Y' OR elected_plan IS NULL)Tara |
 |
|
|
sqllearner
Aged Yak Warrior
639 Posts |
Posted - 2004-10-08 : 19:10:00
|
| Thanks a lot tara it works... |
 |
|
|
|
|
|