HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Search
-
Re: SQL/Gdn_Model: Get previous and next entry WHERE...
-
Re: SQL/Gdn_Model: Get previous and next entry WHERE...
Oh yes, you've asked for the Garden syntax, sorry. x00 already gave that information. Maybe you can avoid 2 database calls by using a union $SQL = Gdn::SQL();$SqlNext = $SQL ->Select('ID') ->From('Table') ->Where('ID >', $KnownID) ->OrderBy('ID', 'asc') ->Limit(1) ->GetSelect();$SqlPrevious = $SQL ->Select('ID')… -
SQL/Gdn_Model: Get previous and next entry WHERE...
Maybe someone with SQL knowledge can help me out here: I'm trying to fetch the previous and the next entry for an ID from the database. I can't just go by the ID, because I need a where clause, e.g. "previous post by this user in that thread" What is the "best" (most efficient) way to do this and how would I do it using… -
Re: SQL/Gdn_Model: Get previous and next entry WHERE...
I like views. Don't know if that is more efficient because it could be cached, but if you need more than on Previous/Next value, it would be great to get it with a simple query. public function Setup() { $SQL = Gdn::SQL(); $ViewSql = $SQL ->Select('t.ID') ->Select('p.ID', 'max', 'PreviousID') ->Select('n.ID', 'min',…
4 results