HELP ON QUERYS

H

HELP

Hi,

can u help me.

i have two tables one with all the sales that where made
on WHAT DATE, WITH THE TIME E.G 20040406205652 This is the
format the date is in.

the second table is a link from the main campagin table
that has all the customer details in.

what i need to do is the following
1. select the data, the sale is form e.g 20040101* then in
both of tables its has got spare1 and spare2.
2. what i have done is linked both tables by phonenumber
in the query.

3. is there a way that i can get one date e.g if i want to
know all the sales that where made on 20041001 & then i
can have a query that takes the sales from tblContracts
updates the real codes from the dbo_Campaign link table,
so what code is in dbo_Campaign can update only them codes
for 20041001 sales.
the codes that need change are only spare1 and spare2 in
tblContracts.
in tblContracts the codes in spare1 and spare2 are wrong.
The right codes are in dbo_Campaign BUT thier are more
then one codes we have about 6 different codes for
different sales.

How can i do this
First Query
SELECT tblContracts.TransactionID, tblContracts.HomePhone,
dbo_Campaign.Spare1, dbo_Campaign.Spare2 INTO Partone
FROM tblContracts INNER JOIN dbo_Campaign ON
tblContracts.HomePhone = dbo_Campaign.PhoneNum;

Second Query
SELECT Left([TransactionID],8) AS [Date],
tblContracts.HomePhone, dbo_Campaign.Spare1,
dbo_Campaign.Spare2 INTO Partone
FROM tblContracts INNER JOIN dbo_Campaign ON
tblContracts.HomePhone = dbo_Campaign.PhoneNum
WHERE (((Left([TransactionID],8)) Like ([Enter Date -
YYYYMMDD] & "*") Or (Left([TransactionID],8)) Like
([Enter
Date - YYYYMMDD] & "*")));

HELP!!!!!!!!!!!!!!!
 
J

John Spencer (MVP)

I'm sorry, but I don't really understand what you are asking.

One thing that may help you solve your problem is to use the DateValue function
to get just the date from your date field. I am assuming that your
TransactionID is a DateTime field that you have choosen to display in the format
yyyymmddhhnnss. If it is a text field then you will need to do something else.

DateValue(TransactionID)

That returns ONLY the date part of the date and drops the time.

WHERE DateValue(TransactionID) = CDate([Enter the Date - YYYY-MM-DD Format])
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top