User Profile
Collapse
-
Anyone? - is it that simple that answering it would seam unnecessary? -
-
Limiting results based on comparing two SELECT values
My second thread on thescripts, so hoping to get the same feedback and help as last time...
I've developed an online invoicing and payment system for all my accounts for my web design company. I've been extending the functionality tonight and have come across a problem...
I'd like to limit the results based on comparing the total and paid results as below.
QUERY
[CODE=mysql]SELECT A.id,A.date,A.j ob,(A.price1*A. qty1+A.price2*A .qty2+A.price3* A.qty3)... -
Cracked It!!!
Finally got it solved...
[CODE="mysql"]SELECT startDate, endDate, IF(startDate >= NOW(), startDate, endDate) date_sort, name FROM events WHERE publish=1 AND expired=0 ORDER BY date_sort[/CODE]
RESULT based on original results (first post) ======
startDate - endDate - date_sort - name
=============== =============== =========
2008-02-22 - 0000-00-00 - 2008-02-22 - Hans...Leave a comment:
-
Yeah, that's getting closer.
All events with an endDate!=0000-00-00 that have past their startDate are right at the bottom now instead of scattered through the results based on their endDate. It's a bit more usable now that they don't take up all the room at the top of the first page.
But is there anyway to tweak this query further to order just those results by endDate with startDates that have past? But still keeping them...Leave a comment:
-
Thanks Ronald,
But that still retrieves the same results in the same order. Just because the dates are joined together doesn't make them ORDER BY any differently.
UPDATED SQL =============== =====
=============== =============== ==
UPDATED RESULT (as of 25 Feb) ======...Code:SELECT startDate,endDate,CONCAT(startDate,endDate) as dates,name FROM `events` WHERE publish=1 AND expired=0 ORDER BY dates
Leave a comment:
-
hodgeman started a topic Events order by startDate, EndDate - show single date events above date rangesin MySQLEvents order by startDate, EndDate - show single date events above date ranges
Hello thescripts forums users...
I've found a lot of answers to problems I've had in the past from this forum, and this is the first mySQL query issue I haven't been able to find an answer from anywhere so thought my time first post should be here.
With that out the way...
I have a website I've built for my day job rotoruaNZ.com/events that I'd like to improve upon.
We have numerous events...
No activity results to display
Show More
Leave a comment: