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 |
|
Indrajit
Starting Member
11 Posts |
Posted - 2012-07-31 : 06:42:34
|
| In my table Rack Cell QtyA1 X 20A1 Y 30A1 Z 10B1 A 34B2 B 50how to select only A1 Rack with related cell Value without giving conditionIndrajitDasgupta |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2012-07-31 : 06:51:11
|
| not sure what you mean about the conditionselect *from tblwhere rack = 'A1'if you don't want a where clauseselect top 3 *from tblorder by Rack==========================================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. |
 |
|
|
LoztInSpace
Aged Yak Warrior
940 Posts |
Posted - 2012-07-31 : 06:53:23
|
| Of course you can't - what kind of constraint is "not giving condition".select t.* from table t inner join (select 'a1' rack) x on t.rack=x.rack.Even if you join to a table it's still a condition - what are you trying to do? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-07-31 : 09:46:29
|
| [code]select top 1 with ties *from tableorder by Rack[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
LoztInSpace
Aged Yak Warrior
940 Posts |
Posted - 2012-07-31 : 10:14:33
|
| The condition is that A1 is the first alphabetically (or top 3) in the table. It's still a condition! The only unconditional set of a set is the set :)Maybe the OP can explain the reason and clarify the question. Seems a bit pointless so far. |
 |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2012-07-31 : 11:16:13
|
| It's a condition of the data not a conditional clause in the query.Yep - the suggestions are as pointless as the question.==========================================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. |
 |
|
|
|
|
|