I have a problem with a SQL query. I got the following query working, which pretty basic:
SELECT *
FROM table1
WHERE Date = CURDATE()
There’s a column in table1 which is called h_id and a table2 with the columns h_id and name
I want to join those two tables so that I have the names out of table 2 from the current date.
I tried this, but it doesn’t seem to work
SELECT t2.name, t1.field2
FROM table1 t1
INNER JOIN table2 t2 ON t1.H_ID = t2.H_ID
WHERE t1.Date = CURDATE( )
It might be case sensitive.
or
does table1 have field2 column?
If not/so, and according to your question, try it like this:
Another possibility is the where clause, try it like this:
A last possibility is that there isn’t any h_id equal from table1 and table2.