MySQL Forums
Forum List  »  Newbie

inserting + sorting
Posted by: Mateus Almeida da Silva
Date: March 29, 2012 09:46AM

Hello,
I'm experimenting some things in MySQL, and having some trouble with a special task, which is this:

-> 1st part:
There is a table "sell_registry", which has two important columns:
a. the first column, "client_code", has a special unique code assigned to each costumer;
b. the second columns, "sell_date", has the date in which the client bought a car.

Ok, so I need to transfer the column "sell_date" to another table, let's call it "testing". The problem is: this second table already has a "client_code" field. So, when I transfer the "sell_date" from the first to the second, I need that the data matches, according to "client_code" field.

In another words: if I have a "Phill" that bought a car in 2001-01-01, I need this date inserted in every field associated to Phill in the second table. Am I clear? How can I do that?


-> second part:
I need to do a calculus with two dates. I need to subtract: "actual date" - "sell_date" (both are "datetime" values). Problem: the result needs be in "months", in an integer value. What should I do?

Options: ReplyQuote


Subject
Written By
Posted
inserting + sorting
March 29, 2012 09:46AM
March 29, 2012 04:08PM
March 29, 2012 04:10PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.