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

Recommended Answers

All 12 Replies

Member Avatar for diafol

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?

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...

Member Avatar for diafol

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.

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
Member Avatar for diafol

Read your first post again and tell me this thread makes sense.

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

Member Avatar for diafol

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?

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 ..

Member Avatar for diafol

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?

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 
Member Avatar for diafol

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.

commented: There's only so many times and ways one can say "you have multiple 1-1's in your data" +6

thank you and sorry about that...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.