![]() |
MyChenQL, part 7
How can I INSERT into a table a row...but have that row be inserted into the table as the first row, not the last?
I know I can do ORDER BY but that's not a viable solution for the problem. |
just a thought..
dont know if its possible... Somehow you could use the array_unshift function? - miSt |
Well for PHP that would be fine but I don't believe there's an applicable MySQL function...
|
Could you query the database to output its structure then use variables for the elements of it then use these elements in an array?
- miSt |
I don't see how that would help :confused:
FWIW I'm trying to give ORDER BY precedence over GROUP BY, and more importantly, not have to do it with multiple queries, temporary tables, and all that extra junk. Plain-English query: select the greatest datetime from the posts table for each forumid. Posts table schema: Code:
mysql> describe posts; |
SELECT forumid, MAX(datetime) AS datetime FROM posts GROUP BY forumid
something like that? |
Don't think it's working:
Code:
mysql> select forumid,max(datetime),subject as datetime from posts group by forumid; |
where did the subjects as datetime appear from, thats not in my query....
|
I added it (see the query above). It seems that GROUP BY only works with the first rows it encounters.
|
explain what you want done in proper english, you never mentioned anything about the subject.
Also use SELECT forumid, MAX(datetime) as datetime, subject FROM posts GROUP BY forumid |
I want information (for now just SELECT *) about the latest datetime for each forumid.
I have a theory though which I'm trying now. |
Idea didn't work:
Code:
mysql> select forumid,datetime,10000000000 - datetime as datetimediff,subject from posts group by forumid order by datetimediff; |
*sigh* Unforuntately it looks like I'll have to use a cache of some sort :(
|
SELECT forumid, MAX(datetime) as datetime, subject FROM posts GROUP BY forumid ORDER BY datetime
|
Nope.
|
All times are GMT. The time now is 02:01 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|