I have to figure out a custom SQL query within tableau to extract a singular field from a custom fields table. The table is comprised of custom fields for each candidate in a offer process. So every 10 or so rows shows the custom fields (office location, vacation days, salary, etc..) for every candidate.
I want to just extract the custom field labeled "Vacation Days". Here's my table layout:
As shown in picture, the offers table connects to the offer_custom_fields table based on "offer_id"
How do I now extract display_value when the custom_field column = "Vacation Days"?
Here's kind of my logic, but I don't know SQL at all:
SELECT
offer_id, display_value
FROM
offer_custom_fields
WHERE
custom_field = (WHERE custom_field = ‘Vacation Days’)
Any help would be greatly appreciated!
CodePudding user response:
If i understood your problem this should work:
SELECT offer_id, display_value FROM offer_custom_fields WHERE custom_field = 'Vacation Days';
CodePudding user response:
The where clause should be like:
SELECT
offer_id, display_value
FROM
offer_custom_fields
WHERE
custom_field = 'Vacation Days';
Also possible if you want to be more flexible: (The % stands for zero or more characters)
SELECT
offer_id, display_value
FROM
offer_custom_fields
WHERE
custom_field like '%Vacation Days%';