Skip to content
Advertisement

Left Join return not all row

I have two tables: baseresulttables and historyviewdemands.

I want to get the first n entries from baseresulttables, and if there are values for them in historyviewdemands.

But the query works like an inner join.

What am I doing wrong?

baseresulttables

historyviewdemands

Query:

reuslt

Advertisement

Answer

Using LIMIT without ORDER BY is fairly meaningless, because you aren’t telling MySQL which order to use for choosing a certain number of records. Add an ORDER BY clause to query for best results.

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