| Author |
Topic  |
|
|
kishore7
Starting Member
13 Posts |
Posted - 08/06/2012 : 16:26:14
|
Hi,
In my table i hav first_name and email id's i need help in writing a query a, such that it fetches only records that has email id's that has domain name as gmail
for ex
abc@gmail.com (i want only records , with gmail) xyz@yahoo.com(i dont want these records)
thanks in advance |
|
|
chadmat
The Chadinator
USA
1961 Posts |
Posted - 08/06/2012 : 16:33:32
|
SELECT email FROM Table WHERE email LIKE '%gmail.com'
-Chad |
 |
|
|
kishore7
Starting Member
13 Posts |
Posted - 08/06/2012 : 16:38:07
|
Thanks for the reply,,
But how can i get all the records, without gmail in their email id's
|
 |
|
|
chadmat
The Chadinator
USA
1961 Posts |
Posted - 08/06/2012 : 16:41:45
|
I dislike answering questions like this because I am sure there is a better way to do whatever it is you are doing, but to answer the question, just use NOT LIKE in the same query.
-Chad |
 |
|
|
xhostx
Constraint Violating Yak Guru
USA
261 Posts |
Posted - 08/07/2012 : 09:24:06
|
this will do the work: declare @e varchar(100) set @e='abaaac.aaaaa001@gmail.com' select SUBSTRING(@e, 1, CHARINDEX('@',@e)-1)
-------------------------- Joins are what RDBMS's do for a living |
 |
|
| |
Topic  |
|