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 |
|
raysefo
Constraint Violating Yak Guru
260 Posts |
Posted - 2010-12-03 : 04:14:19
|
| Hi,I have a select statement that results more than 1 rows.Here is the statemtselect Tasks.IsApproved from Tasks,Tasks_Grup where Tasks.grup = Tasks_Grup.id and Tasks.IsApproved = 0 and Tasks.approver like '%abc%' or Tasks.deputy = 'abc'Result isIsApproved10But I would like to GET ONLY IsApproved 0 and i should join those two tables as well. (Tasks and Tasks_Grup)Thanks in advance.Best Regards |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-12-03 : 04:21:54
|
quote: Originally posted by raysefo Hi,I have a select statement that results more than 1 rows.Here is the statemtselect Tasks.IsApproved from Tasks,Tasks_Grup where Tasks.grup = Tasks_Grup.id and Tasks.IsApproved = 0 and (Tasks.approver like '%abc%' or Tasks.deputy = 'abc')Result isIsApproved10But I would like to GET ONLY IsApproved 0 and i should join those two tables as well. (Tasks and Tasks_Grup)Thanks in advance.Best Regards
No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
raysefo
Constraint Violating Yak Guru
260 Posts |
Posted - 2010-12-03 : 04:28:17
|
| Did you reply webfred? |
 |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2010-12-03 : 04:33:15
|
| select Tasks.IsApproved -- should this be Tasks.*from Tasksjoin Tasks_Grupon Tasks.grup = Tasks_Grup.idwhere Tasks.IsApproved = 0and (Tasks.approver like '%abc%' or Tasks.deputy = 'abc')==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-12-03 : 04:39:32
|
quote: Originally posted by raysefo Did you reply webfred?
Yes I did.See the red marked parentheses... No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
raysefo
Constraint Violating Yak Guru
260 Posts |
Posted - 2010-12-03 : 04:45:58
|
| thanks so much for both of you :) |
 |
|
|
|
|
|