By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,335 Members | 2,718 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,335 IT Pros & Developers. It's quick & easy.

Help in query

P: n/a
I need the 11,13 equipment1 in table tbl_Events from table
tbl_EquipmentChronology

Table:tbl_EquipmentChronology
TicketNum Outlet Equipment1
1486 1 SABGJMLRS
1486 2 SABGJPFZH
1486 3 SABGJPGDB
1486 4 SABJCKCMZ
1486 5 SABGJPGBV
1486 6 SABJHJZLJ
1486 7 SABJRZZHR
1486 8 SABHFMXQM
1486 9 SABHCBNWC
1486 11 SABHFVLPP
1486 13 SABGVPCTV

Table: tbl_Events
TicketNum PPVVOD_Outlet Equipment1
1486 11
1486 13

Thanks,

Aug 15 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
It's a LOT faster to read the HELP File than to post here every five
minutes. How about an INSERT/APPEND query. And who knows, you might
actually learn something.

Aug 15 '06 #2

P: n/a
Eric wrote:
I need the 11,13 equipment1 in table tbl_Events from table
tbl_EquipmentChronology

Table:tbl_EquipmentChronology
TicketNum Outlet Equipment1
1486 1 SABGJMLRS
1486 2 SABGJPFZH
1486 3 SABGJPGDB
1486 4 SABJCKCMZ
1486 5 SABGJPGBV
1486 6 SABJHJZLJ
1486 7 SABJRZZHR
1486 8 SABHFMXQM
1486 9 SABHCBNWC
1486 11 SABHFVLPP
1486 13 SABGVPCTV

Table: tbl_Events
TicketNum PPVVOD_Outlet Equipment1
1486 11
1486 13

Thanks,
If the result you are looking for is
1486 11 SABHFVLPP
1486 13 SABGVPCTV
try

SELECT A.Ticketnum, A.Outlet, A.Equipment
FROM tbl_Events AS B LEFT JOIN tbl_EquipmentChronology AS A ON
A.TicketNum = B.TicketNum
WHERE A.Outlet = B.PPVVODOutlet;

If you actually mean to update Equipment1 in tbl_Events try

UPDATE tbl_Events INNER JOIN Tbl_EquipmentChronology
ON tbl_Events.TicketNum = Tbl_EquipmentChronology.TicketNum
SET tbl_Events.Equipment1 = Tbl_EquipmentChronology.Equipment
WHERE tbl_Events.PPVVODOutlet = Tbl_EquipmentChronology.Outlet;

FYI I do not feel the latter query is trivial. The method of updating a
table based on values from another table depends on the SQL dialect you
are working with. Google "update from another table sql access" for
examples.

HTH
--
Smartin
Aug 17 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.