question

GaryKeramidas-2715 avatar image
0 Votes"
GaryKeramidas-2715 asked GaryKeramidas-2715 answered

can results be in order of IN keyword condtions?

i'm using item numbers for the IN conditions to return a total of each item number ordered for sales orders between 2 dates. i need the results to be in the same order the item numbers appear in the IN statement. the item numbers in the IN statement are not sorted in any way.
is this possible?
if i use a date range i get a different order of results than if i use no date range and just the item numbers. but, neither is correct.


sql-server-general
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

GaryKeramidas-2715 avatar image
0 Votes"
GaryKeramidas-2715 answered

when i look at the tempdb database, there is a table dbo#tbl but it has numerous underscore characters follwed by 00000000000A as the table name

create table #tbl(data varchar(10),no numeric(3) )
INSERT into #tbl(Data, No)
VALUES('Pineapple', 1),
('Banana', 2),
('Orange', 3),
('Apple', 4)

i'll try your declare example and see what happens

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

GaryKeramidas-2715 avatar image
0 Votes"
GaryKeramidas-2715 answered

ok, thanks for your help. i'm just going to give up because i'm not going to bother you with my lack of knowledge with this. but, i did learn a few things, so thanks for that.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.