Problem with a query in MySQL

0

I have a problem with how to formulate a query to obtain the following: I have a table called TBL_BIT_TIPO_INGRESO where I store the types of economic income when registering some students. It is assumed that by default a text that says "FAMILY" is saved in the field type_income and then another record can be added in case the student obtains another type of income, for example "OWN" or "PROGRAM_GOVERMENT".

But the system that I made example has a failure and when it stores a New student does not keep the record with the default text that he mentioned above but he keeps the other records in case another type is registered Of income. I want to make a query to get those students who do not have records with the text "FAMILY" in the field type_income. In the example of the image would come A4A12, A3B07, A3B20 and A7C25 but I can not do it, can you explain?

    
asked by Ivan92 30.01.2018 в 03:34
source

2 answers

0

Indicate in your query that you want to show all the rows of data where the type of income is different from FAMILY, that you get with the operator! =

SELECT * FROM TBL_BIT_TIPO_INGRESO WHERE tipo_ingreso!='FAMILIA'

    
answered by 30.01.2018 / 03:55
source
-1

For text comparisons it is better to use LIKE, in this case you can use NOT LIKE

SELECT * FROM TBL_BIT_TIPO_INGRESO WHERE tipo_ingreso NOT LIKE 'FAMILIA'
    
answered by 30.01.2018 в 04:37