Good afternoon,
I need to make a select that returns the description of the product, barcode and price .
The description and price are in one table (TB_ESTOQUE) and the barcode is in another (TB_EST_PRODUCT).
However, the IDs of the records in the two tables do not match to make a direct JOIN because the customer has deleted items from the stock. There is a connection table (TB_EST_IDENTIFIER) between ID's ID_EST and ID_IDENTIFIER.
ThecodeIwrotesofar,wasquotedbelow.ButitisreturningtheitemsbymatchingtheIDs,joiningtherecordsofthetablesthathavetheID_ESTOQUEandID_IDENTIFIERequalinarow.
SELECTprod.id_identificador,est.id_estoque,prod.cod_barra,est.DESCRICAOasDESCRICAO,est.PRC_VENDAasPRC_VENDAFROM(TB_EST_PRODUTOprodJOINTB_ESTOQUEestONprod.ID_IDENTIFICADOR=est.ID_ESTOQUE)JOINtb_est_identificadoridentONprod.id_identificador=ident.id_identificador
Thesystemscreenisthis:
Then I need the select to return these items as the system shows.