0 pts.
 timestamp and comparing different tables
SQL
hello i'm quite a beginner at this stuff.. right now i have a very basic database: 2 tables: Table 1: Handheld_tags: 2 columns Column 1: tag_in varchar(16) Column 2: time_in timestamp Table 2: Registered_tags: 2 columns Column 1: tag_reg varchar(16) Column 2: time_reg timestamp 1. Now I'm loading the Registered_tags table with a text file that has tag_reg data but need the timestamp to be put automatically when the row is added to that table.. The query is: load data infile "expected.txt" into table registered_tags lines terminated by 'rn' But all the timestamp values i get in the table are 0000-00-00 00:00:00 I've tried putting in NOW() and NULL for the field value in the text file but same thing.. 2. I need to compare the "tag_in" column in Handheld_tags table with the "tag_reg" column in Registered_tags table... - To see the common entries in these two columns.. - To see whats in tag_in column and not in tag_reg and vice versa.. How do i go about this ? Thnak you for your help..

Software/Hardware used:
ASKED: September 22, 2005  9:28 AM
UPDATED: September 22, 2005  10:01 AM

Answer Wiki:
I'm not sure how well this is going to display here, but: 1: LOAD DATA INFILE 'expected.txt' INTO TABLE registered_tags FIELDS TERMINATED BY ',' ENCLOSED BY '' LINES TERMINATED BY 'n' STARTING BY '' This figures your fields are comma delimited, one record per line. 2a: SELECT * FROM Handheld_tags a,Registered_tags b WHERE a.tag_in=b.tag_reg 2b: SELECT * FROM Handheld_tags WHERE tag_in NOT IN (SELECT tag_reg FROM Registered_tags )
Last Wiki Answer Submitted:  September 22, 2005  10:01 am  by  This213   0 pts.
All Answer Wiki Contributors:  This213   0 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _