Grouping (1 Viewer)

gisash1

Registered User.
Local time
Today, 03:53
Joined
Aug 23, 2004
Messages
31
I have a table which is looks like that:

1 2 3
3135-10 Style 1 Brown
3135-40 Style 1 Brown
3135-20 Style 1 Brown
4009-30 Style 2 Green
4009-10 Style 2 Green
4009-20 Style 2 Green
4009-CT Style 2 Green
3135-20 Style 1 Red
3135-10 Style 1 Red
3135-30 Style 1 Red



Is it possible to sort the table in this way?

1 2 3
3135-10 Style 1 Brown
3135-20 Style 1 Brown
3135-40 Style 1 Brown
3135-10 Style 1 Red
3135-20 Style 1 Red
3135-30 Style 1 Red
4009-10 Style 2 Green
4009-20 Style 2 Green
4009-30 Style 2 Green
4009-CT Style 2 Green


Because whatever I try it goes like that:

1 2 3
3135-10 Style 1 Brown
3135-10 Style 1 Red
3135-20 Style 1 Brown
3135-20 Style 1 Red
3135-30 Style 1 Red
3135-40 Style 1 Brown
4009-10 Style 2 Green
4009-20 Style 2 Green
4009-30 Style 2 Green
4009-CT Style 2 Green


Thank you very much in advance
 

Jon K

Registered User.
Local time
Today, 10:53
Joined
May 22, 2002
Messages
2,209
Try this query (replacing with the correct field names and table name):-

SELECT [Field1], [Field2], [Field3]
FROM [TableName]
ORDER BY left([Field1],4), [Field3], Right([Field1],2)
.
 

gisash1

Registered User.
Local time
Today, 03:53
Joined
Aug 23, 2004
Messages
31
Jon, thanks a lot,
I've tried to creat the quiry in existing DataBase and definitely I miss something. Could you look through my table, thank you!!
 

gisash1

Registered User.
Local time
Today, 03:53
Joined
Aug 23, 2004
Messages
31
forgot to attach Zip
 

Attachments

  • testMDB.zip
    7.8 KB · Views: 115

gisash1

Registered User.
Local time
Today, 03:53
Joined
Aug 23, 2004
Messages
31
Jon, Thanks
I used Left(InStr([Field],"-")-1) , it's working now
Thanks again
 

Users who are viewing this thread

Top Bottom