SQL Server 2005 SELECT TOP 1 from VIEW returns LAST row -
I have a view that could have more than one line, looking like this: < Pre> but it always gives the last line of the scene. Actually, if I only run subconscious by myself, then I only get the last line. Returns the 1st and 3rd rows in the top 2 sequence, with 3 rows in the sequence. With 4 rows, it is returning the top 3 in sequence. Still the top 1 is still returning to the final. DERP?!? This works .. .. but someone can tell me why behave so ruthlessly before and what do I have to do? As stated in the comments, there is no meaningful pillar through which I can make an order. Can I force that order in which the rows are inserted for the order in which they have returned? I also noticed that: Select 1 rate above This is by design. If you do not specify this If the query should be resolved, then the database is free to return the records in no order. There is no natural order for the table, which is not available for the default sort order. . In fact, how this order will be decided how the query has been planned, so you can not depend on the same query, consistent results over time, as The database will collect data about the data and how it can change the plan of the query based on it. To expect a record, you just have to specify how you want them sorted. For example: [rate] | [Seller ID] 8374 1234 6523 4321 5234 9374 In an SPROC, I must set an absolute value equal to the value of the column before the first line of view. Something like this:
DECLARE @rate int; SET @rate = (Select the top 1 rate from Vendor_view where VendorID = 123) SELECT @rate
DECLARE @rate int; # Log in the table (vRate) (select the rate from vendor_view where vendorID = 123) SET @rate = (select top 1 vRate from #temp) Select @rate drop table #temp
(select [Define]] also returns true values again and again. [/ Edit]
Select the top 1 rate from vendor_view where vendor id = 123 order rate
Comments
Post a Comment