|
I have problem in my database,
I hope to everybody to help me solve from my problem. Advice me !
In databse :
- I Have 2 tables that each value in field can be talked the same.
Table I | Table II
(P.key) -field Date = 12/05/03 | -field date = 12/05/03
(P.key) -field Time = 08:00 am | -field Time = 18:00 pm
(P.key) -field No.ID = 98470012 | -field No.ID = 98470012
-field Trans = C (come) | -field Trans = G (gohome)
In my case :
- I want to find value in field trans that in table I there is but in table II there aren`t or converse.
How am I find it ?, thank`s before.
|
|
|
I THINK I know what you are asking. You want to select all records in table 1 where the trans ID is NOT in table 2. Right? If so:
select *
from table1
where ID not in (select ID from table2)
Without knowing your application, this seems like a strange table architecture. Perhaps you`d be better off with one table like so:
TransID (BIGINT - Primary Key IDENTITY)
ComeDate (DATETIME)
GoHomeDate (DATETIME)
This assumes that you first create the record when the "come" happens. So ComeDate would also serve as your original "transaction timestamp". My point is, analyze your table structure, you may find that you are better off with ONE table instead of the two.
|
|
|
|
|
Thank 4 ur advice, let`s me try.
|
|
|
|
|
|
|
|
|
|