Friday, March 30, 2012

Query Problems!

I'm having a problem write a query that pulls the new updated data from tbl1. The fields are state_no and date_insp. the criteria for the search is 00054000 & 1/1/2003 until present time.
I want to compare that data to tbl2 to see if it has any pre-existing data such as tbl1.Owner name, tbl1.Owner_addy, tbl2Owner_name, tbl2.Owner_addy so that I'm not duplicating the date in tbl2 when i do the import.

If this isn't clear to your please write back and I will explain more.HERE'S A QUERY THAT i CAME UP WITH TO TRY AND SEE IF IT WORKS BUT I DON'T THINK THAT ITS CHECKING EARLIER STATE_NO:

SELECT DISTINCT STATE_NO, OWNER_NAME, BUSINESS_NAME
FROM TESTNEWIMPORTBOILER T, HBC_CONTACT C
where state_no >= '00054000' and date_inspection >= '1/1/2003'
AND
T.OWNER_NAME =
(SELECT BUSINESS_NAME
FROM HBC_CONTACT
WHERE BUSINESS_NAME = T.OWNER_NAME)

Originally posted by Bigced_21
I'm having a problem write a query that pulls the new updated data from tbl1. The fields are state_no and date_insp. the criteria for the search is 00054000 & 1/1/2003 until present time.
I want to compare that data to tbl2 to see if it has any pre-existing data such as tbl1.Owner name, tbl1.Owner_addy, tbl2Owner_name, tbl2.Owner_addy so that I'm not duplicating the date in tbl2 when i do the import.

If this isn't clear to your please write back and I will explain more.

No comments:

Post a Comment