zwork zwork - 1 year ago 52
SQL Question

Selecting certain columns from a single row that contain @

I am attempting to extract a single row from a MySQL database table, but with certain parameters specified. The username of the row has to match what was used to login, and the variable

must match as well. I only want to pull out data from the columns whose data contains the @ symbol (so that I know it's an email). What is the best way to do this?

EDIT: The table has the following rows:
, and group emails labelled
. I want to pull out only the
columns from a single row that have content.

Answer Source

Use a SQL query to check if the username and the groupname match, and add another condition for finding some character in a string (in this example the "@") after that you should parse the string in which the above constraints are met , this can be done using for loops(which is basically iterating over the string) or using recursive queries in sql , see this link

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