1
2
3
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 activerecord, rails, ruby, sql, short

How can I turn this into so...

Avatar Talk
1
2
3
4
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 ruby, rails, joins, activerecord, sql

I have a method called rank...

931970b8dc51b72e05e3a12b88612d61 Talk
1
2
3
4
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, self, select

Actually it's not PHP. And ...

F59c10b458e4212b941ba215422266ce Talk
1
2
3
4
    #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 iteratate, sum, sql, ruby

I have an actions table tha...

7c3536f0ffdc51a02ec2c9d1d72165d5 Talk
1
2
3
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
1
2
3
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
1
2
3
4
<?php

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

PHP FLAC -> Multiple File Ty...

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

This is part of a larger pr...

98ae5419a4fd2b739280c3ed7d6cdb3d Talk
1
2
3
4
Tables:

items
...

PHP SQL JOIN vs. tmpTable

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

The first codesnippet last ...

Avatar Talk