Best approach for adding timestamp to return most popular rows

you asked for an example, the query i posted is an example

didn’t realize you weren’t clear on the different types of joins, sorry

Its not that I’m not clear, it’s just I’ve only ever used/needed to use LEFT JOIN.
On a positive note, another lesson learned.

You learn by making mistakes :sunglasses:

Ok, so now we have this cleared up, INNER JOIN is the right join to use?
And will this affect our query, or we just need to change the join?

Also, if the current join works, what are the benefits of changing the join to INNER, besides doing things probably?

Thanks, Barry

Left Join

Showing rows 0 - 9 (10 total, Query took 0.0060 sec)

Inner Join

Showing rows 0 - 9 (10 total, Query took 0.0044 sec)

Not much difference, maybe when I have 1000’s of records, we might see a change.

The query works well whichever JOIN is used.
Speed is good and does exactly what we need :smile:

I’ll bring this to a close then @r937 I sense you have had enough with this now ha
Unless there is anything important to add?

Thanks again for your patience and guidance, appreciated!

Barry

this type of thinking is going to trip you up sooner than you think

there’s a reason inner and outer joins are different

Ok, we best finish with the right result :slight_smile:

The big question…

INNER or LEFT?

I assume now we understand exactly what we need, INNER is the correct join to use else we’ll be returned redundant records.

Barry

As r937 posted, beware of “it seems to work”

Maybe this will help? For me diagrams make it easier to understand.

Inner Join

Left Outer Join

Right Outer Join

Full Outer Join

3 Likes

Perfect!

I’ll give this a read, any questions will post back, though I think everything is covered here :sunglasses:
Bringing back memories ha - I’ve read this before some time ago need a refresh.

Though off first glimpse of the diagrams its very clear INNER JOIN is what I need in this instance.

Thanks for the resource and thanks Rudy!

Until the next thread :+1:

Barry

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.