Jump to content


Photo

Select starting from record 5 then BACK to record 1


  • Please log in to reply
15 replies to this topic

#1 willpower

willpower
  • Members
  • PipPipPip
  • Advanced Member
  • 296 posts
  • LocationWarrington, Cheshire, UK

Posted 31 July 2006 - 10:14 PM

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


Wait...I've got it...Bollocks, it's gone again!

If at first you don't succeed....stop using ASP and get onto PHP

#2 BillyBoB

BillyBoB
  • Members
  • PipPipPip
  • Advanced Member
  • 630 posts

Posted 31 July 2006 - 10:24 PM

do you want them to display ordered by lastest or starting from 5 then to the end and then 1-4 ???



#3 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 31 July 2006 - 10:33 PM

i think he wants the current month, then ascending order until december, then jan to last month, as in those horoscope articles.

one question for willpower: how do you store the star signs dates?
Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...

#4 willpower

willpower
  • Members
  • PipPipPip
  • Advanced Member
  • 296 posts
  • LocationWarrington, Cheshire, UK

Posted 31 July 2006 - 10:53 PM

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

Wait...I've got it...Bollocks, it's gone again!

If at first you don't succeed....stop using ASP and get onto PHP

#5 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 31 July 2006 - 11:09 PM

hmm
SELECT * FROM signs ORDER BY startm*100+startd>=MONTH()*100+DAY() DESC,startm,startd

Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...

#6 willpower

willpower
  • Members
  • PipPipPip
  • Advanced Member
  • 296 posts
  • LocationWarrington, Cheshire, UK

Posted 31 July 2006 - 11:16 PM

that gives me a sytax error
Wait...I've got it...Bollocks, it's gone again!

If at first you don't succeed....stop using ASP and get onto PHP

#7 willpower

willpower
  • Members
  • PipPipPip
  • Advanced Member
  • 296 posts
  • LocationWarrington, Cheshire, UK

Posted 31 July 2006 - 11:19 PM

ps could you explain what that should have done so i can try and amend it also?

Thanks
Wait...I've got it...Bollocks, it's gone again!

If at first you don't succeed....stop using ASP and get onto PHP

#8 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 31 July 2006 - 11:24 PM

sorry, i forgot something in the MONTH and DAY
SELECT * FROM signs ORDER BY startm*100+startd>=MONTH(NOW())*100+DAY(NOW()) DESC,startm,startd

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.
Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...

#9 willpower

willpower
  • Members
  • PipPipPip
  • Advanced Member
  • 296 posts
  • LocationWarrington, Cheshire, UK

Posted 31 July 2006 - 11:38 PM

oh....so close.  I wish i understood the query.

I now get the order i want but the starting record is out by one...i get virgo rather than libra....by the way...i hate horoscopes.

any ideas?

Will
Wait...I've got it...Bollocks, it's gone again!

If at first you don't succeed....stop using ASP and get onto PHP

#10 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 31 July 2006 - 11:43 PM

damn, i make so many mistakes today :)
SELECT * FROM signs ORDER BY MONTH(NOW())*100+DAY(NOW()) >= startm*100+startd DESC,startm,startd

Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...

#11 willpower

willpower
  • Members
  • PipPipPip
  • Advanced Member
  • 296 posts
  • LocationWarrington, Cheshire, UK

Posted 31 July 2006 - 11:49 PM

lol.  Thanks so much for your help....its now worse and starts with some other star sign ;)

I bow to your greatness....regardless of how many mistakes you make!!!

Will
Wait...I've got it...Bollocks, it's gone again!

If at first you don't succeed....stop using ASP and get onto PHP

#12 willpower

willpower
  • Members
  • PipPipPip
  • Advanced Member
  • 296 posts
  • LocationWarrington, Cheshire, UK

Posted 01 August 2006 - 12:01 AM

What can i say....THANK YOU
Wait...I've got it...Bollocks, it's gone again!

If at first you don't succeed....stop using ASP and get onto PHP

#13 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 01 August 2006 - 12:06 AM

SELECT * FROM signs ORDER BY endm*100+endd>=MONTH(NOW())*100+DAY(NOW()) DESC,startm,startd

Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...

#14 willpower

willpower
  • Members
  • PipPipPip
  • Advanced Member
  • 296 posts
  • LocationWarrington, Cheshire, UK

Posted 14 August 2006 - 12:03 AM

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
Wait...I've got it...Bollocks, it's gone again!

If at first you don't succeed....stop using ASP and get onto PHP

#15 willpower

willpower
  • Members
  • PipPipPip
  • Advanced Member
  • 296 posts
  • LocationWarrington, Cheshire, UK

Posted 14 August 2006 - 10:03 AM

bump
Wait...I've got it...Bollocks, it's gone again!

If at first you don't succeed....stop using ASP and get onto PHP

#16 willpower

willpower
  • Members
  • PipPipPip
  • Advanced Member
  • 296 posts
  • LocationWarrington, Cheshire, UK

Posted 16 August 2006 - 12:15 AM

double bump
Wait...I've got it...Bollocks, it's gone again!

If at first you don't succeed....stop using ASP and get onto PHP




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users