Filter in a grid application

Hello i need some advice and help , i have a table named clients and in this table i have customer but company too who ask for my services. i need to build 2 grid application in one to show the data from table where are only customer and in second grid application to can show only the data with companies based on field name_srl… becasue the companies are less than regular customer there are lot of empty data in name_companies field. so i want to show it separatlei in 2 tables

for example when i write this in SQL
SELECT * FROM Clienti WHERE name_companies != “” this will show me only the row that have data in that field and its great, but in grid application i couldnt make it to work

Can anyone pease help me with this, to write a code for me and to tell where to put it ?

thank you

Trying to understand here. So you have 2 tables…company and customer. You only want customer to show if they do not have an associated company or you want customer to show if they are associated with one company?

no it is online one table with customers lets say with this field name customer , name company the rest are comon fields like adress and town , but i have more regular customers than companies and becasue of that the field name companies are empty the most of the time
so i need to call a table only with with the field that are not empty in a table for example. and a table with the clients in other table without the name company filed. i hope i make me clear

it should be straightforward. So in clients it is just select field1, field2 from clients where name_company is null (assuming you have it set to null and not empty string) or select field1, field2 from clients where name_company is not null. It really depends if you have the name_company field set to be null or empty string. If you are set to empty, your first idea should work. If this is not what you are asking, can you show an example of your tables and what you want in the finished table? It doesn’t sound like the two are joined in any way.

Which database?
Try to use

SELECT * FROM Clienti WHERE name_companies IS NOT NULL

but also i suggest to have 2 related tables, 1 for Clients and 1 for Companies

So you want Clients who have a company listed and the company information is in Companies. They have name_companies in common. Then just base it on: select clientfield1, clientfield2 from clients, companies where clients.name_companies=companies.name_companies. Or if you just want ONE company to show, have a control form with a select of all companies_names from companies and when they choose, pass it as a variable to a grid which uses that for the company selection.

Another thing on the grid of all clients is to have a refined search with company_name as the select field and they can simply choose the ones they want to display based on company_name.

I have a table in MySQL in which I insert both customers and companies, but with two different fields, one name for customers and one name_company for companies, I want to make a invoice for customers where the customer’s name appears and another invoice where the company name appears. How can I do this? Being both a customer and a company in the same table are two different fields.

I think you can use UNION Clause for Join same table.
select … from clients where your_type = ‘client’
union
select … from clients where your_type = ‘company’

As long as number of fields is the same.