A query with those fields, that are not required to get from huge fields within a table

Sanjay Suthar

           i want a query to display few fields from a table on webpage, but there are huge number of fields in that table, but i want such type of query that except few fields and displaying all remaining fields' data on web page. Like: i have a table with 50 fields,

+--------+--------+--------+----------+     +----------+
|  Col1  |  Col2  |   Col3  |   Col4   | ---- |  Col50  |
|---------|---------|----------|-----------|       |-----------|
|           |            |            |              | ---- |             |
|           |            |            |              | ---- |             |
+-------+--------+--------+----------+     +----------+

but i want to display only 48 fields on that page. then any query that except those 2 fields name(Col49 and Col50) that are not required and show remaining data. So instead of writing:
SELECT Col1, Col2, Col3, Col4,...Col48 FROM table;
any alternate way to writing like that
SELECT *-(Col49,Col50) FROM table;

Mahesh Madushanka

The best way to solve this is using view you can create view with those 18 columns and retrieve data form it

example

mysql> SELECT * FROM calls;
+----+------------+---------+
| id | date       | user_id |
+----+------------+---------+
|  1 | 2016-06-22 |       1 |
|  2 | 2016-06-22 |    NULL |
|  3 | 2016-06-22 |    NULL |
|  4 | 2016-06-23 |       2 |
|  5 | 2016-06-23 |       1 |
|  6 | 2016-06-23 |       1 |
|  7 | 2016-06-23 |    NULL |
+----+------------+---------+
7 rows in set (0.06 sec)

mysql> CREATE VIEW C_VIEW AS
    ->     SELECT id,date from calls;
Query OK, 0 rows affected (0.20 sec)

mysql> select * from C_VIEW;
+----+------------+
| id | date       |
+----+------------+
|  1 | 2016-06-22 |
|  2 | 2016-06-22 |
|  3 | 2016-06-22 |
|  4 | 2016-06-23 |
|  5 | 2016-06-23 |
|  6 | 2016-06-23 |
|  7 | 2016-06-23 |
+----+------------+
7 rows in set (0.00 sec)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Select query to get fields within JSON in orientdb

From Dev

Select query to get fields within JSON in orientdb

From Dev

Unable to pull fields from within LINQ query

From Dev

get required fields from json schema

From Dev

Required fields within a p:tabView

From Dev

How to query datetime fields between date range, and also within those dates between times in SQL

From Dev

HQL Query to get fields from @ElementCollection

From Dev

How to use CQLinq to get metrics of Methods and Fields within a single query

From Dev

How to get just the fields from a table in MySQL?

From Dev

Get the values of two fields from a table JOIN

From Dev

How to get just the fields from a table in MySQL?

From Dev

Datatables AJAX Get Fields from joined Table

From Dev

Django, get all required fields?

From Dev

Conditioning Required Fields from others

From Dev

WordPress Advanced Custom Fields Get value from Checkbox Within Repeater

From Dev

WordPress Advanced Custom Fields Get value from Checkbox Within Repeater

From Dev

Replace spaces in a file without changing those within fields

From Dev

SQL Query MAX date and some fields from other table

From Dev

Return all fields from table or return that not exist in one query

From Dev

Three Joins fields in table 2 override those in table 1

From Dev

Comparing 2 fields within a Mongo Aggregation Query

From Dev

SQL Access, Concatenate fields within query

From Dev

Get specific fields with MongoDb query

From Dev

Parse iOS SDK, cannot get all fields from _User table

From Dev

Adding records to fields which get data from another table

From Dev

PHP/MySQL - Get multiple fields from one entry in a table

From Dev

Get all fields from activerecord, filtered by a column in a different table

From Dev

how to get data from 2 fields json in table css

From Dev

merge (combine) fields from a query

Related Related

  1. 1

    Select query to get fields within JSON in orientdb

  2. 2

    Select query to get fields within JSON in orientdb

  3. 3

    Unable to pull fields from within LINQ query

  4. 4

    get required fields from json schema

  5. 5

    Required fields within a p:tabView

  6. 6

    How to query datetime fields between date range, and also within those dates between times in SQL

  7. 7

    HQL Query to get fields from @ElementCollection

  8. 8

    How to use CQLinq to get metrics of Methods and Fields within a single query

  9. 9

    How to get just the fields from a table in MySQL?

  10. 10

    Get the values of two fields from a table JOIN

  11. 11

    How to get just the fields from a table in MySQL?

  12. 12

    Datatables AJAX Get Fields from joined Table

  13. 13

    Django, get all required fields?

  14. 14

    Conditioning Required Fields from others

  15. 15

    WordPress Advanced Custom Fields Get value from Checkbox Within Repeater

  16. 16

    WordPress Advanced Custom Fields Get value from Checkbox Within Repeater

  17. 17

    Replace spaces in a file without changing those within fields

  18. 18

    SQL Query MAX date and some fields from other table

  19. 19

    Return all fields from table or return that not exist in one query

  20. 20

    Three Joins fields in table 2 override those in table 1

  21. 21

    Comparing 2 fields within a Mongo Aggregation Query

  22. 22

    SQL Access, Concatenate fields within query

  23. 23

    Get specific fields with MongoDb query

  24. 24

    Parse iOS SDK, cannot get all fields from _User table

  25. 25

    Adding records to fields which get data from another table

  26. 26

    PHP/MySQL - Get multiple fields from one entry in a table

  27. 27

    Get all fields from activerecord, filtered by a column in a different table

  28. 28

    how to get data from 2 fields json in table css

  29. 29

    merge (combine) fields from a query

HotTag

Archive