Little K
Little K

Reputation: 13

Amazon Redshift: Joining two columns where column content is slightly different

I tried everything I could possibly find in this forum. Here is what I'm trying to do:

Exam Name
-----------
Data Analysis
Data Visualization
Data Warehousing
Big Data

Course Name
------------
Exam Readiness: Data Analysis
Exam Readiness: Data Visualization
Exam Readiness: Data Warehousing
Exam Readiness: Big Data

Basically, I'm trying to find out who took the exam readiness courses before they took the respective exam. Is there any way I can use LIKE clause on two columns? The only difference is, Course Name has "Exam Readiness" in the front.

I tried these two below:

1st query:

select * from table
where course_name like '%'+ exam_name + '%'

2nd query:

select * from table
WHERE COLUMNA LIKE '%'||COLUMNB||'%'

These are two different queries, not one query.

Upvotes: 0

Views: 1270

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 270224

Try:

SELECT
  foo
FROM exam
JOIN course ON (course.name = 'Exam Readiness: ' || exam.name)

Upvotes: 3

Related Questions