Skip to content
Advertisement

SQL for 2 tables

I have these 2 tables:

Table A can be linked with table B by field “State”.

What would be the query to get the latest (last visit date) in country=US, doesn’t matter which state, e.g.:

US,10-12-2019,FL,Bell

I tried inner join but couldn’t make it work.

Advertisement

Answer

Always try to explain your question with sample data and query you tried for.

Here is query with some sample data:

Expected Result:

Query:

SQL Fiddle

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement