|
-
Feb 14th, 2017, 07:19 AM
#1
[RESOLVED] remove single value from query
Hey all
I have 2 tables A & B
Table A
| id |
name |
suffixID |
| 0 |
him |
0 |
| 1 |
her |
1 |
| 2 |
it |
2 |
Table B
| id |
name |
isActive |
| 0 |
Mr. |
1 |
| 1 |
Mrs. |
1 |
| 2 |
other |
0 |
and this query...
SELECT A.name as Name,B.name as Suffix
FROM A
LEFT JOIN B ON A.suffixID = B.id
should return a table like this (unless my syntax is off which is quite possible)...
Table C
| Name |
Suffix |
| him |
Mr. |
| her |
Mrs. |
| it |
other |
What I need to do is eliminate the value for B.name whereever B.isActive=0. I don't want to remove the row, just the value in the row to have something like this...
Table C
| Name |
Suffix |
| him |
Mr. |
| her |
Mrs. |
| it |
|
Can anyone tell me how to adjust the sql to achieve that?
Thanks
kevin
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|