Displaying 2 results from an estimated 2 matches for "band_id".
Did you mean:
band_uid
2006 Apr 25
6
Searching over multiple MySQL tables
I am racking my brain over this, probably because I only know very
simple mysql functions.
Basically I''ve got a few tables, ex:
Albums (id,name,band_id); Bands (id,name,label_id), and Label (id,name)
I want to search through both album.name, band.name, and label.name
throwing all results into a variable, with no redundant info.
I think what I need to be doing is setting up some foreign key
relationships.
I am on the right track? Or way off?...
2007 Sep 03
0
ActiveRecord question - how to find owners of at least one child with a conditional
Hopefully the subject is clear enough.
Let''s say I''ve got two tables:
create_table :bands do | b |
b.column :name, :string
end
create_table :concerts do | c |
c.column :where, :string
c.column :when, :date
c.column :band_id, :integer
end
and the models:
class Band <<ActiveRecord::Base
has_many :concerts
end
class Concert << ActiveRecord::Base
belongs_to :band
end
What I''d like to do is find all of the Bands which have at least one
concert on or after a given date.
In this case there are l...