dan dan - 2 years ago 55
SQL Question

Select specific rows and columns from an SQL database

Is it possible to retrieve specific columns of specific rows in an

SQL query

Let's say I'm selecting from my
table, called
, rows whose names are: a, b, using this query text:

"select * from my_table where row_names in ('a', 'b') order by row_names"

How can I modify this query text to select only columns 2,12,22,32,42 rather all its 1000 columns?

Answer Source

Replace the wildcard symbol * with the column names you want to retrieve.

But please read up the documentation on SQL standard. It is very unlikely you need 1.000 columns in a table.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download