» Home » record » Page 1
Factory Girl: How to associate a record to another record without creating a new record?
by Piercarlo Slavazza in Programming Languages

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'
Factory.define :org_admin, :parent => :user do |user|
user.email 'org_admin@somehwere.org'
Factory.define :user_with_memb

Mysql Automatically insert specific record if doesn't exist or inserts new record if a specific record is update
by scosant in Programming Languages

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

How can i create a trigger that will only update a record if the new record is different from the old record?
by GregoryWE in Databases

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_marketingliste
ON marketing_list FOR UPDATE

Left Join to select all record from table1 and single (optional) record of table2
by Gold in Databases

In my database i have to table with one to many(optional) relationship 1....0,*

|id| name |
| 1| user1 |
| 2| user2 |
| 3| user3 |

|id|tb1_ID|city |
| 1| 1 |

Django: Duck typing-friendly way of accepting record or slug of record for input
by Knoxy in Web Design

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).

MySql check oldest record against current record with nested queries
by Murali Ravipudi in Databases

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<

Php mysql get the nearest-latest record if a record is not exist (datetime based)
by Imaginer in Programming Languages

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?

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

How to update a record on another table based on the values of the record being modified using a trigger
by riahc3 in Programming Languages

I have two simple (only for explain my problem) tables

X with columns (among others): IDX,CODE,NUMBER
Y with columns (among others): CODE,NUMBER,id_fromX

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:


Implementing a database record hash for keeping track of whether a record has changed or not
by Dannar26 in Databases

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:



I need to be to query to fetch records whose Name, Phone, or Fax fields have ch

Access sometimes jumps to existing record on save new record - Access2k FE/SQL2005 BE
by Matt Willtrout in Databases

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

Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2014 © bighow.org All Rights Reserved .