MySql query ordering in JOIN tables
Good day every one I have three MySql tables
-Doc
-DocType
-Org
I made a query like that:
Select Doc.Code,Doc.DataAccept,DocTypes.Name,Org.Name
From Doc,DocTypes,Org
Where Doc.Type=DocTypes.Code AND Doc.Org=Org.Code AND Doc.Code;
in Result i have
|Code|DataAccept|Name|Name|
17 | - | - | - |
18 | - | - | - |
24 | - | - | - |
26 | - | - | - |
32 | - | - | - |
the Code field is not in series
if made query like
Select Doc.Code,Doc.DataAccept,DocTypes.Name,Org.Name
From Doc,DocTypes,Org
Where Doc.Type=DocTypes.Code AND Doc.Org=Org.Code AND Doc.Code AND
Doc.Code < 100;
than it's ok
|Code|DataAccept|Name|Name|
1 | - | - | - |
2 | - | - | - |
3 | - | - | - |
4 | - | - | - |
5 | - | - | - |
if Doc.Code < 1000 than again it's not in series I try to use ORDER BY
Code but in result i have ordered not in series
What i did missing here ?
Thank you for your time , and forgive my English
"-" - it is a normal data , use it just for represent.
No comments:
Post a Comment