question

radouan_naam avatar image
radouan_naam asked

how to get column name if it has specific value

how to get column names if it has specific value.

I need this sentence below in the correct syntax.
select all_column_names from mytable where any.column_value=5;

columnvalue
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Jon Crawford avatar image
Jon Crawford answered

that's an ugly query you are trying to run. Advise you figure out what is really being asked for and why, then figure out what subset of tables/columns really would apply, and search those only. Otherwise you're basically going to have to search through every column in every table in the database to find your value, when most of them won't even matter for what you're looking for.

If the user can't give you better requirements than that, odds are you can ignore it completely, because they don't know what they heck they want.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.