0

Hi
i have a table route

day,position...
day  position
1      1
1      2
1      3
1      4
then day pass to number 2 and position passes to 1 i have these data in my table but when i order the table by day..position are all messed..if i order the 2 fields then i have 
day  position
1      1
1      1
1      1
1      1
......

any idea please

2
Contributors
12
Replies
41
Views
2 Years
Discussion Span
Last Post by asaidi
Featured Replies
  • 1
    diafol 3,669   2 Years Ago

    Ok, I'm going around in circles here. Sorry asaidi, there seems to be a terminal communication breakdown. I shall leave you in the capable hands of other Daniweb members. Read More

0

Show your SQL. On the surface of it I'd assume

...ORDER BY `day`, `position`

Can't udnerstand why you'd have multiple 1-1 or are there multiple records with 1-1 etc?

0

Hi
mutiple 1 because for each 1 has 1 to 26
2 has 1 27
3 1..26 etc
there day who has from 1 to 26 and in each day has position...

0

No I meant you seem to have many records with 1-1 (from your previous post)

day  position
1      1
1      1

I can't get my head around why this should be the case. So show your SQL as originally requested.

0
select day,position,prl_no,name from route order by day,position limit 400;
normally day 1  position 1
         day 1            2
             1            3
             and so
             2            1
             2             2
             2            3
0

the 1 represent monday and in monday the van an have a lot of routes
these routes must be in order..that he starts from 1 then go to 2 and so..
then the 2 represent tuesday....and so

0

This is getting extremely frustrating asaidi. I understand what you've been saying about the daynumber and the order of positions. It's just that in your first post you showed an example output of

day  position
1      1
1      1
1      1
1      1

I've been trying to get you to explain the reason for that output. If you have multiple records where day=1 and position=1, then yes you'll get that output, but if you don't then you shouldn't. So what on earth is going on with your data?

0

Hi
sorry if i was not clear..
it cannot be equal..for a day=1 position can have 1..26 not 1-1-1-1-1
then for day =2 the same position can have from 1..26
and so..
sorry about that ..

0

The sql you have will order the records as you want:

SELECT `day`,`position`,`prl_no`,`name` FROM `route` ORDER BY `day`,`position` LIMIT 400;

So what exactly are you asking?

0
my question is there a way in mysql to display day as
for example  position
1 1
1 2
1 3
2 1
2 2
2 3
....
not as
1    1
1    1
1    1 
1    1 
1

Ok, I'm going around in circles here. Sorry asaidi, there seems to be a terminal communication breakdown. I shall leave you in the capable hands of other Daniweb members.

Votes + Comments
There's only so many times and ways one can say "you have multiple 1-1's in your data"
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.