sql - Creating a union in access with multiple tables and field on one table being the same as multiple fields on others -


here current query

screenshot of form:

screenshot

select * jdsubs  inner join amipartnumbers on amipartnumbers.oemitem = jdsubs.oempartnumber     ((([txtenternumber])     in ([jdsubs].[oemsubnumber],[jdsubs].[oempartnumber]))); union select * ihsubs  inner join amipartnumbers on amipartnumbers.oemitem = ihsubs.oempartnumber     ((([txtenternumber])     in ([ihsubs].[oemsubnumber],[ihsubs].[oempartnumber]))); union select * mfsubs  inner join amipartnumbers on amipartnumbers.oemitem =mfsubs.oempartnumber     ((([txtenternumber])     in ([mfsubs].[oemsubnumber],[mfsubs].[oempartnumber]))); 

can simplify union on 1 query on query can compare txtenternumber oemsubnumber , oempartnumber?

i feel 1 query doing work.

or doing right?

i'm searching millions records want make sure efficient possible

you'll have run is. assuming oemitem, oempartnumber, & oemsubnumber indexed, should be.

if union first, try compare part numbers, you'll doing against un-indexed query result.

a couple of ideas improvement are:

  • if part number can match match just one parts table, each query 1 @ time until result back.
  • combine 3 of part tables (setting 1 field flag determine part origin), run search against table.

good luck


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -