Jump to content

Select starting from record 5 then BACK to record 1


willpower

Recommended Posts

Well sort off.

I establish the date.  I then want to go to a db containing start signs and find out which is the current star sign based on the date.  I then want to list all start signs starting with the most current.

ie Records retrieved could be in this order

5
6
7
8
9
10
11
12
1
2
3
4

I have lost the plot on this...can anyone help me to do this???

Thanks in advance

will

hi i have a startd and startm field - and a endd and endm

ie
startd = 22
startm = 07
endd = 23
endm = 08

And yes I want them to display in chronological order. so if capricorn was the current sign I want to display the ALL but starting with capricorn...or if it were gemini the same etc.

Hope that makes sense
sorry, i forgot something in the MONTH and DAY
[code]SELECT * FROM signs ORDER BY startm*100+startd>=MONTH(NOW())*100+DAY(NOW()) DESC,startm,startd[/code]

basically startm*100+startd>=MONTH(NOW())*100+DAY(NOW()) is to figure out whether or not today is on or after the start of a starsign (1 if on or after, 0 if before). We use DESC because you want 0 to appear later (the months before this sign). then, after the first sort, we proceed to do it chronologically with startm and startd.
  • 2 weeks later...
After all this time...i have noticed an issue...Capricorn comes last in the list rather than between sag and aquarius. 

Current list reads

leo: correct
Virgo : correct
Libra: correct
Scorpio :correct
Sagitaruis: correct
Aquarius : correct in that it has looped back to the start but capricorn omiited
Pisces: correct
Aries : correct
Taurus : correct
Gemini : corect
Cancer : correct
Capricorn : god damn it

Any clues?
PS is it to do with the fact that capricorn starts in month 12 and ends in month 1

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.