/    Sign up×
Community /Pin to ProfileBookmark

No Dupe ON this Select

I have a table where I’m selecting a collection of rows.

Each row is used at least once, but maybe more.

What I need to do is JOIN my table via my linking table to my information table.

I can do this and it works. I get my main row content and things like titles data etc from the 3rd table linked.

The issue I have is if a particular row is linked to 2 rows in my third table via 2 links my linking table my output is double.

I don’t need both, just the first, or second just one anyway.

Anyway of doing this?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@SempervivumMar 23.2021 — Use SELECT DISTINCT?
Copy linkTweet thisAlerts:
@NogDogMar 23.2021 — > @Sempervivum#1629550 Use SELECT DISTINCT?

Yeah, that would seem simplest if, in fact, the columns you need from the duplicates would have the same values (i.e. only select columns that would be the same, if you don't need the ones that might differ).

Otherwise you might need to either use one or more subqueries (with limit = 1) within the select clause, or maybe some aggregating functions with a group by? Hard to tell without specific details.
×

Success!

Help @kiwis spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 3.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,

tipper: Anonymous,
tipped: article
amount: 10 SATS,
)...