text: I'm using Factory Girl/Rspec2/Rails 3.
  In factories.rb, I
  have:
  Factory.define :user do |user| user.name
  'Some guy' user.email 'some_guy@somewhere.org'
  user.password 'password'endFactory.define :org_admin, :parent
  => :user do |user| user.email 'org_admin@somehwere.org'endFactory.define :user_with_memb
  I'm using php and mysql to develop an application; A little background
  data about it,it's a login system which stores usernames and passwords and
  all the works that a login system does. However I have ran into a problem
  when it comes to deleting users, the function for deleting users works fine
  but the problem is For example the administrator can delete himself leaving
  the database with no use
  Question is create a trigger that will only update a record if the old
  record is different from the new. Can i get some help please i don't even
  know how to start the syntax apart from
  CREATE TRIGGER
  update_marketinglisteON marketing_list FOR UPDATEASBEGIN SELECT * FROM INSERTEDEND
  In my database i have to table with one to many(optional) relationship
  1....0,*
  1....0,*
  Table1:+--+---------+|id|
  name |+--+---------+| 1| user1 || 2| user2 || 3| user3 |+--+---------+
  Table2+--+------+-------+|id|tb1_ID|city |+--+------+-------+| 1| 1 |
  I have a function like this:
  def foo(bar):
  ...
  Now bar can either be a Django record
  or the slug pointing to a record. I need this flexibility so that I can
  call this function when I have the actual record at hand or am calling this
  from a more generic function that only has bar available as a string
  (pulled from a database).
  bar
  My head is spinning trying to figure out the SQL query I need to use. I
  have tried a variety of nested queries and self joins and everything is
  failing me. I assume I am WAY over thinking it.
  Basic idea: I
  have a single table, let's call it OrderTable and there are
  four (relevant) fields in the table: OrderId,
  CustomerId, RestaurantId<
  OrderTable
  OrderId
  CustomerId
  RestaurantId<
  Trying to get my head around, If I select a record such as WHERE
  item_id='$item_id' AND date(datetime)='2012-06-25' and if that
  record does not exist so I want to get the nearest-latest record after that
  date. How can I achieve that in a query?
  WHERE
  item_id='$item_id' AND date(datetime)='2012-06-25'
  All I can think of
  the only way right now is if num_of_rows is 0 then I add 3 days period
  ahead to that day and search again a
  I have two simple (only for explain my problem) tables
  I want to (after insert or update table X)
  update table Y using variables from actual record from X.To do this I
  try to use trigger (in table X) like below:
  SET TERM ^^ ;CREATE TRIGGER XYZFOR X
  I have database schema for an integration project in which I need to be
  able to query for records that have changed, but only based on a given set
  of fields within that record.
  So, for instance, here's an
  example table:
  CUSTOMERS
  I need to be to query to fetch records whose
  Name, Phone, or Fax fields have ch
  this is my first question on SO, am really posting this out of
  desperation after searching around a lot for an answer and trying a few
  different things with no success.
  I have an Access database
  where I have recently migrated the tables to SQL 2005, Access continues to
  function to the users as a front-end providing forms, reports, and queries.
  However, since moving to