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 |
|
battle59
Starting Member
8 Posts |
Posted - 2007-04-05 : 11:31:05
|
| Hi I am fairly new to this, and I searched the forums before posting this, but I couldn't find anything that applies. I was having trouble removing/counting for records that include a certain value. Ex, I want to know how many records in the LASTNAME field have an @ anywhere in the field. I formerly used FoxPro and the way I could check was "Count for atc("@",LASTNAME)<>0".I tried this sql query " SELECT COUNT(*) AS COUNT FROM `DATABASE` WHERE LOCATE(‘@’, LASTNAME)>0 " however, it didn't work. Can someone please help? |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-04-05 : 11:36:10
|
[code]select count(*)from tableswhere lastname like '%@%'[/code] KH |
 |
|
|
battle59
Starting Member
8 Posts |
Posted - 2007-04-05 : 11:46:46
|
That worked.Thank you so much!!!quote: Originally posted by khtan
select count(*)from tableswhere lastname like '%@%' KH
|
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-04-05 : 23:58:43
|
| One more methodselect count(*)from tableswhere charindex('@',lastname)>0MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|