So I decided to try PostgreSQL instead of MySQL, but I'm facing some minor conversion problems. It was a question to me that samples are from four tables and spit them out on the result.
How am I at the loss of expressing it in PostgreSQL and especially in Django, but I'm leaving for that one more quesiton so bonus points if you can Django-fy, but no Do not worry if you only pure it SQL
link, Linksksated, Linkskurl, Linksktitle, as the user works .username, category.title, SUM (votes.karma_delta), SUM (IF (Exclude external left in user_vote form from link (votes.user_id = 1, votes.karma_delta, 0)) link `` `` users` user` `(` link `` `` `user_id``` user` .````) Include `` categories` at category` (`links` .`category_id` =` category`.`id`) Join the outer exits at `votes` votes`` (` votes`.`link_id` = `links`. `Id`) Where (links.id = votes.link_id) by votes.link_id command group (sum (votes.karma_delta) - 1) / pow ((TIMESTAMPDIFF (Acoaar link. could, now ()) + 2) , 1.5) D SC range 20 She began my first problems in that selection. It seems that this is true / wrong then the other stuff is the end IF so far I can not get the syntax right. I tried to use Navicat's SQL Builder, but it consistently wanted me to pick up all my things in Group Bye and I think it's all wrong. What I'm seeing in brief is the MySQL query work in PostSyQL Thanks. Current progress Just want to thank everyone for their help select links_link.id , links_link.created, links_link.url, links_link.title, links_category.title, sUM (links_vote.karma_delta) karma Yoga (as in: is it when the case I have done so far links_vote.user_id = 1 THEN links_vote.karma_delta ELSE 0 END) as to engage the upper Ovropr URL URI Link_link on auth_user oN (links_link.user_id = auth_user.id) lEFT OUTER join links_category oN (links_link.category_id = links_category.id) lEFT OUTER JOIN links_vote (links_vote.link_id = Links_link.id) Where (links_link.id = links_vote .link_id) links_link.id, links_link.created, links_link.url, links_link.title, command group links_link.created DESC limit 20 by links_category.title I have to change a table name And I'm still working on my order till then we get out of the police. Thanks again! Some things: Drop backticks < Li> IF () instead of case use a case statement. Votes_id = 1 Then vote.karma_delta or else 0 end Change your timestampdiff DATE_TRUNC ( 'h', now ()) - DATE_TRUNC ( 'hour', links.created) (you will result very easy to compare the need to calculate the number of hours in the gaps. timestamp) Ordering by your group Please correct
Get link
Facebook
X
Pinterest
Email
Other Apps
Comments
Post a Comment
Popular posts from this blog
c# - How to capture HTTP packet with SharpPcap -
-
June 15, 2013
I would like to capture all incoming HTTP packets on my machine. To do this, I am using SharpPcap which is a WinPcap The cover is. SharpPcap works very well, but it captures TCP packets and what it wants to do for me is a very low level. Does anyone know how can I easily get full HTTP requests / reactions from all these TCP packets? Thanks SharpPcap is already able to capture the packet in the same way That's what the virus does (just in the code instead of the GUI). And you can either either parse them directly or you can put them in the drive in the common .pcap file format. The steps to parse the capture are: Open a connection at any time Loop a while Or start capturing using an event callback Parsing the raw packet for the type you want If you are reading .PPP dump files In addition to calling you an offline capture reader is almost the same, there is no need to select an interface, and you can set the majority There is no need to do the modes. All st...
Read more
php - Multiple Select with Explode: only returns the word "Array" -
-
March 15, 2012
By using Wordpress I have created a multiple selection box so that users can select categories to exclude. When the page is initially loaded, I see my predefined default option. However, when I select a new value and I save ... I only see the word "Array" and have not chosen anything else? & lt; Class = "amultiple" id = "& lt; php echo $ value ['id'] ;? gt;" name = "& gt; php echo $ value ['id'] ;; gt; []" Multiple = "multiple" size = "8" & gt; & Lt ;? Php global option; Foreign currency ($ value as value $) {if (get_settings ($ value ['id']) === FALSE {$$ value ['id'] = $ value ['std']; } And {$$ value ['id'] = get_settings ($ value ['id']); }} $ Ranges = & amp; Amp; Categories ('type = post & orderbiz = name & amp; hide_empty = 1'); If ($ ranges) {$ ex_cat = implode (',', $ tt_cat_exclude); Forex Currency ($ range a...
Read more
jquery - SimpleModal Confirm fails to submit form -
-
May 15, 2012
I am trying to confirm jQuery to show yes / no confirmation when I submit a form. I had modified (in the last list) to capture and block form submissions. However, it only works with jQuery 1.2.6, a recent upgrade stops 1.3.2, if yes is clicked, then by submitting the form. But I can not understand what is wrong / inconsistent in my code now. Demo (which works in both versions of a simple window.href implementation). $ (document) .ready (function () {$ ('input.delete'). Click (function (e) {e.preventDefault (); var target = $ (e .target); Confirm ("Really delete this event?", Function () {target.click ()});});}); How about something like this? The idea of catching clicks (and fire!) On the submitted event is not click event. $ (document) .ready (function () {$ ('# myForm'). Submit (function () {var f = this; Confirm (" Remove? ", Function () {$ (f). Submit ();}) Return; Return the initial session;}}}}; Hope That this is som...
Read more
Powered by Blogger
Theme images by Michael Elkan
Mind Blowing Facts
Visit profile
Archive
September 2015190
August 2015221
July 2015202
June 2015174
May 2015204
April 2015211
March 2015179
February 2015192
January 2015162
September 2014188
August 2014188
July 2014190
June 2014212
May 2014205
April 2014212
March 2014194
February 2014200
January 2014190
September 2013182
August 2013206
July 2013188
June 2013171
May 2013198
April 2013174
March 2013213
February 2013186
January 2013219
September 2012218
August 2012192
July 2012185
June 2012182
May 2012190
April 2012189
March 2012185
February 2012207
January 2012203
September 2011198
August 2011193
July 2011197
June 2011198
May 2011220
April 2011215
March 2011178
February 2011184
January 2011173
September 2010168
August 2010187
July 2010190
June 2010211
May 2010191
April 2010188
March 2010190
February 2010217
January 2010200
Show more
Show less
Report Abuse