SELECT p.pid, p.filename, AVG(v.vote) as avgv, COUNT(v.vote) as avgc
			FROM wp_ngg_pictures p
			LEFT JOIN wp_nggv_votes v ON (p.pid = v.pid)
...

PHP SQL Query Optimization

by https://www.google.com/accounts/o8/id?id=AItOawmyRuor7Z0aC0QytK3lMrz5h5jH73-dECw, December 13, 2011 21:03, 3 refactorings, tagged with speed, sql, optimization

This SQL query is currently...

55502f40dc8b7c769880b10874abc9d0 Talk
select distinct(user_id) from facebook_post_comments where page_id =some_page_id and user_id in (select distinct(user_id) from facebook_post_comments where page_id = some_other_page_id)

Python MySQL O(n^2)

by https://www.google.com/accounts/o8/id?id=AItOawlXyCfS3cPSoWLo635rrzVPpmDr0-DUdus, October 20, 2011 12:54, 2 refactorings, tagged with sql, mysql, short clean ruby

Hello! Trying to run this q...

55502f40dc8b7c769880b10874abc9d0 Talk
procedure TfrmOperationDetail.SaveOperationInfo;
var
  s: string;
...

Delphi What has been called a &quo...

by blackbird-crow-raven.myopenid.com, December 30, 2010 16:51, 1 refactoring, tagged with sql, ado, delphi, steaming pile of horse dung

I am refactoring a large ap...

55502f40dc8b7c769880b10874abc9d0 Talk
def self.find_for(options = {})
    scope = scoped
    scope = scope.where(:hook => options[:hook].to_s)  if options[:hook]
...

Ruby ActiveRecord query construc...

by https://www.google.com/accounts/o8/id?id=AItOawmLF7gR3CIpZoZXbwO7fiD2QWYltD3lwpM, December 23, 2010 15:27, 1 refactoring, tagged with rails, sql, activerecord, rails3, arel

Rails 3.0.3

This method ...

55502f40dc8b7c769880b10874abc9d0 Talk
# link_categories has_many links
create_table "link_categories", :force => true do |t|
  t.string   "name"
...

Ruby Find records according to r...

by https://www.google.com/accounts/o8/id?id=AItOawl_CInyr4p6Fw9fCXT3DYEGIiMyGOQDomw, August 02, 2010 18:43, 1 refactoring, tagged with rails, sql, ruby, activerecord

I have a method (LinkCatego...

55502f40dc8b7c769880b10874abc9d0 Talk
// Stored procedure: IsItUnique

CREATE PROCEDURE [dbo].[IsItUnique]
...

C# SQL Server - Similarity Score

by ruby, March 20, 2010 19:33, 2 refactorings, tagged with sql, Text Similarity

First of all I apologize fo...

42d18a359135982c319658d02c826bfb Talk
Clip.find_by_sql(["select * from clips where not exists
        (select 'clip_id' from histories where histories.clip_id = clips.id
        and histories.user_id = ?) ORDER BY clips.created_at DESC LIMIT 20", user.id])

Ruby ActiveRecord find_by_sql

by David, January 17, 2010 20:52, 5 refactorings, tagged with rails, sql, short, ruby, activerecord

How can I turn this into so...

D41d8cd98f00b204e9800998ecf8427e Talk
class Item < ActiveRecord::Base
  ALL_VOTES = "all_votes"
  SCORE = "score"
...

Ruby Complex query in Ruby on Ra...

by Pablo, January 10, 2010 13:27, No refactoring, tagged with rails, sql, ruby, activerecord, joins

I have a method called rank...

931970b8dc51b72e05e3a12b88612d61 Talk
select rrr.account_number,
       summa,
       to_char(to_date('19570101', 'YYYYMMDD') + max(rrr.lst_pay_dn),
...

PHP Can I do it without accessi...

by zsolt.botykai.org, March 03, 2009 16:42, 1 refactoring, tagged with sql, join, select, self

Actually it's not PHP. And ...

F59c10b458e4212b941ba215422266ce Talk
#players = select distinct(player) from actions;
    players = repository(:default).adapter.query('select distinct(player) from actions')

...

Ruby getting 20-100+ sums in one go

by feydr.myopenid.com, February 10, 2009 19:13, 2 refactorings, tagged with sql, ruby, iteratate, sum

I have an actions table tha...

7c3536f0ffdc51a02ec2c9d1d72165d5 Talk
Declare @Index varchar(128)
...

C# Drop all Indexes in SQL Server

by GateKiller, October 07, 2008 10:48, 4 refactorings, tagged with sql, Index

The below is some code I re...

98c852e2d9b26249745ea92c72964d3f Talk
Use Master

...

C# Backup All MS SQL Server Da...

by GateKiller, September 19, 2008 15:19, 2 refactorings, tagged with sql

I've recently blogged about...

98c852e2d9b26249745ea92c72964d3f Talk
<?php

$flacpath = '/bin/flac';
...

PHP FLAC -> Multiple File Ty...

by wegosublime, October 31, 2007 17:33, 5 refactorings, tagged with sql, cron, mp3, flac, ogg, music, record company, shell, command line

This is part of a larger pr...

98ae5419a4fd2b739280c3ed7d6cdb3d Talk
Tables:

items
...

PHP SQL JOIN vs. tmpTable

by jackbauer.myopenid.com, October 30, 2007 16:32, 5 refactorings, tagged with sql

The first codesnippet last ...

55502f40dc8b7c769880b10874abc9d0 Talk