TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
darma teja
NA
496
336.4k
sql query
Mar 1 2015 4:42 PM
Hi all,
I have a table like this:
Table1
id
name
comment
1
test
null
2
test1
abc
3
test1
def
4
TEST2
abc
5
test3
abc
6
test3
def
7
TEST4
abc
I would like to get all rows
1. where comment='null'
2. if name (Example: test1) has 'abc' and 'def' in comment column than show only where comment= 'def'
3. if name has only 'abc' than show that row
the output should be like this:
id
name
comment
1
test
null
2
test1
def
3
TEST2
abc
4
test3
def
5
TEST4
abc
How can I write the query for this scenario?
Thanks,
Darma
Reply
Answers (
8
)
Clustered and Non-Clustered Index
Delete symbols in database