Reputation: 607
this is how i join 2 tables and select form it:
OleDbDataAdapter DataA = new OleDbDataAdapter(@"Select tfr.FeedID, tf.FeedName, tfr.FeedQuantity, tf.DM
FROM tFeeds AS tf
INNER JOIN tFeedsRations AS tfr ON (tf.FeedID=tfr.FeedID)", Connection);
but what about adding a access query to this select command? for example I want to add this statement to my select command:
Select qfq.FeedDMQuantites
From qFeeds_Quantities as qfq
what should I do?
Upvotes: 2
Views: 2941
Reputation: 77846
Well add another JOIN
condition to this table qFeeds_Quantities
(assuming you have a relationship to this table or a common column among other table).
Assuming you have a common column like FeedID
in this new table as well you can make another JOIN
like
select tfr.FeedID, tf.FeedName, tfr.FeedQuantity,
tf.DM, qfq.FeedDMQuantites
FROM (tFeeds AS tf
INNER JOIN tFeedsRations AS tfr ON tf.FeedID = tfr.FeedID)
INNER JOIN qFeeds_Quantities as qfq ON tf.FeedID = qfq.FeedID;
If you want to include another JOIN
then parenthesize like
FROM ((tFeeds AS tf
INNER JOIN tFeedsRations AS tfr ON tf.FeedID = tfr.FeedID)
INNER JOIN qFeeds_Quantities as qfq ON tf.FeedID = qfq.FeedID)
INNER JOIN BLAH AS bll ON bll.test = tf.test;
Upvotes: 5