Jump to content

[SOLVED] Distinctrow issues when jioning three tables


jvrothjr

Recommended Posts

"SELECT distinctrow 
tblblockbatches.Block_Batch_ID, tblblockbatches.Primary_Batch_Number, 
tblblockbatches.Secondary_Batch_Number, tblitemmaster.Block_Description, 
tblitemmaster.Part_Number 
FROM (tblblockbatches 
LEFT JOIN tblbmr_test_and_inspect 
ON tblblockbatches.Block_Batch_ID = tblbmr_test_and_inspect.Block_Batch_ID) 
INNER JOIN tblitemmaster 
ON tblblockbatches.Item_ID = tblitemmaster.Item_ID 
WHERE (((tblbmr_test_and_inspect.Block_Batch_ID) Is Null)
and ((tblblockbatches.Obsolete)='0'))"

 

That is my query string I am having issues with.

 

It does return the data I wish but also returns Dups.

 

Some times there are two Batches per ID so if a batch was split in the operation. Then there would be two records but only wish to display one in the select box.

 

I have tried Distinct and Group by wish no luck.

 

Been working on this for a few hours with no luck and help with be great.

Link to comment
Share on other sites

Can you show your group by attempt?  It basically depends on what condition you want your rows to be distinct by.

 

If you want only one row for each Block_Batch_ID, and you don't care which row it is, then use "GROUP BY Block_Batch_ID" and you will get what you're looking for.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.