I have this MySQL query:
SELECT *
FROM profiles
WHERE phone = :query
OR email = :query
OR facebook = :query
OR instagram = :query
I need to know what columns the match occurred in. So if the match occurred in.
How do I get that data in the MySQL query?
Edit: The optimal result would be to get all names of matched columns in the returned row.
Edit 2: If I have this table:
+----+---------+----------------+----------------+----------+-----------+
| ID | Name | email | phone | facebook | instagram |
+----+---------+----------------+----------------+----------+-----------+
| 0 | Jill | jill@aol.com | (123)123-1245 | fbjill | igjill |
| 1 | Jack | jack@aol.com | (123)111-1111 | fbjack | igjack |
| 2 | Bob | bob@aol.com | (123)222-2222 | fbbob | igbob |
| 3 | jMarie | jill@aol.com | (123)123-1245 | none | none |
+----+---------+----------------+----------------+----------+-----------+
and I query this:
SELECT *
FROM profiles
WHERE phone = fbjill
OR email = fbjill
OR facebook = fbjill
OR instagram = fbjill
I need it to return the all the data of the row but with an additional columns stating the name of the columns it came from.