Crear productos

Hola de nuevo comunidad. Quería consultar si alguien sabe cómo hacer para realizar una expresión para que me diga lo siguiente:

tengo una tabla de detalle_compras y tengo dos datos  una de inicio de lote y otra fin de lote.


La pregunta que debo responder es:

hay algun número dentro del lote de la tabla lotes que se encuentre dentro del rango (lote de inicio- final del lote)?

no sé cómo hacer para crear esta expresion

 

Si no hay devuelve lista vacía, si hay debe mostrar esos valores

en teoría estoy durmiendo pero al no poder me da vueltas la cabeza con las posibles soluciones. 
agradezco sus respuestas

Solved Solved
0 3 90
1 ACCEPTED SOLUTION

3 REPLIES 3

Translating to english didn't make much sense , for me. 

You have a starting batch and ending batch and you want to check if an item falls between the start and end ? 

How does the batch number look like ? maybe some examples would make it clearer 

Looking for a solution to have a sequence number that needed to be written in 8 digits like 000-00001, 000-00002, 000-00003 etc. and the sequence had to be reset with the batch change. Additionally, the same must have the defined character prefix of 000- .

My structure is:

LOTS_ID LOT_N PROD INITIAL_LOT_N_FINAL_LOT_LIST_LOTS QTY
xxxxxxxxx A1 st08 000-00001 000-00003 1,2,3 3

xxxxxxxYx A2 st02 000-00010 000-00015 10,11,12,13,14,15 6

xxxZxxxxx B9 F95 000-52428 000-52432 28,29,30,31,32 5


I have this in my purchase_detail table, and I need some action or some bot, which takes n_initial_lot, and n_final_lot and calculates the quantity to print them in a new table and thus be able to have them available for sale as unique and individual products.
In the new table where they should be created with the action or bot you would only have:

ID_ind BATCH_N PROD N-prod-indiv
2x1c12 A1 st08 000-00001
45a2a A1 st08 000-00002
ze11cc A1 st08 000-00003
ze11cc B9 F95 000-52428
ze11cc B9 F 95 000-52429
ze11cc B9 F95 000-52430
ze11cc B9 F95 000-52431
ze11cc B9 F95 000-52432

Top Labels in this Space