Saif Lacrimosa
Saif Lacrimosa

Reputation: 70

Display only the columns that contains data

I have a database that have 35 columns and some of those columns are empty and I've already made the page and the query to retrieve the data from the data base but the problem is All the data including the empty ones, and I want to know if there is a resolving to these problem.

Upvotes: 0

Views: 110

Answers (3)

Sandeep Kumar
Sandeep Kumar

Reputation: 803

you can use the where clause in the query

like

 Select * from TableName where FieldName is Not Null And Field2 is not null 

Similarly you can add as many filters as you want

Upvotes: 1

Jess Kenney
Jess Kenney

Reputation: 399

Your query (assuming you're using SQL) should have something like

... my_table.my_field IS NOT NULL ...

see also: MySQL select where column is not empty

Upvotes: 0

Andy G
Andy G

Reputation: 19367

Use the WHERE clause:

WHERE somefield IS NOT NULL

Upvotes: 0

Related Questions