Filter a data in an SQL field

2

I have this query

"SELECT * FROM KTMOVIMIENTOCONTABLE WHERE CM1_TERCERO LIKE '%" + TBNit.Text + "' AND CM1_TIPO = '" + comboBoxTipo.Text + "' AND CM1_NUM LIKE '%" + TBCausacion.Text + "'"

I use it to bring some data but each user has many accounts "CM1_CUENTA" I need to know if among all the accounts there is one that has 2365 or 53152001 if it brings an account with 2365 does something and if it brings 53152001 it does something else

    
asked by Saul Salazar 10.08.2018 в 19:22
source

1 answer

0

From what I understood, you need your query to filter through the field CM1_CUENTA which contain in your data 2365 ..

With a like you can filter the result of your search:

SELECT * 
FROM KTMOVIMIENTOCONTABLE 
WHERE CM1_TERCERO LIKE '%" + TBNit.Text + "' 
AND CM1_TIPO = '" + comboBoxTipo.Text + "' 
AND CM1_NUM LIKE '%" + TBCausacion.Text + "'
AND CM1_CUENTA LIKE '2365%' OR CM1_CUENTA LIKE '%53152001%'

If the data contains '2365' at the beginning of your body, it will show you ...

    
answered by 10.08.2018 / 19:26
source