Hi
How I can execute this query on Ruby?
SELECT *
FROM table_1 T
WHERE T.document_id not in (SELECT distinct documnet_id FROM
binary_files);
Now, I execute without proble the second part of query (SELECT
distinct documnet_id FROM binary_files) in this
method:BinaryFile.find(:first, :select => ‘distinct document_id’)
I’ve all crontrollers and all models
Thank you
On Wed, 10 Oct 2007, luciosan wrote:
distinct documnet_id FROM binary_files) in this
method:BinaryFile.find(:first, :select => ‘distinct document_id’)
dbh = DBI.open(‘dbi:mysql:foo’,‘username’,'password)
dbh.select_all(‘SELECT * FROM table_1 T WHERE T.document_id not in
(SELECT
distinct documnet_id FROM binary_files)’) do |row|
do stuff with rows
end
or, maybe
ksdbh = KSDatabase.new(‘dbi:mysql:foo’,‘username’,'password)
doc_ids = ksdbh.select(:BinaryFiles) do |b|
b.distinct(b.document_id)
end.collect do |d|
d.document_id
end
data = ksdbh.select(:Table1) {|t| t.document_id.not_in(doc_ids)}
I’ve all crontrollers and all models
My point is that there are many ways to do what you ask in Ruby. I
imagine you are actualy wanting to know how to do it in ActiveRecord?
Kirk H.
In article
[email protected][email protected]
wrote:
My point is that there are many ways to do what you ask in Ruby.
I imagine you are actualy wanting to know how to do it in
ActiveRecord?
Thank you for the answare… yes I’m waiting to know how I can do it
in ActiveRecord.
–
I’m using an evaluation license of nemo since 51 days.
You should really try it!
http://www.malcom-mac.com/nemo