🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #11036

Simple SELECT question

#11036
From: Jack
Date: Fri, 27 Dec 2002 14:25
31 lines
1867 bytes
Hello, I've got a simple SELECT question:

There are 2 tables, one containing clients' IDs (unique) and other clients
data, and the other table frn_id (references to unique id from CLIENTS
table) and frn_id_of_hobby (foreign key pointing to HOBBIES table).

So, in HOBBIES table I have eg.

frn_id    frn_id_of_hobby
1        1
1        2
1        5
2        1
2        10

What I need is to select all clients who have ANY hobby (there is a
possibility NOT to select any hobby)

As for now I do it like this:

SELECT *
FROM CLIENTS INNER JOIN CLIENTS_DATA ON CLIENTS.ID = CLIENTS_DATA.FRN_ID

The problem is that if someone enters more than 1 hobby I receive more than
one row for each client, and what I need is only ONE row in case of the
client has ANY hobby.

Supposely is easy (GROUP? ... IN?), but as I'm kinda new in SQLhave to ask
for your help.

For any suggestions TIA
Technical Details
Message-ID: <3e0c6151@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed-west.nntpserver.com!hub1.meganetnews.com!nntpserver.com!telocity-west!DIRECTV!203.109.225.2!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 114a0e,b84b603861029c1d,start
X-Google-Attributes: gid114a0e,public
X-Google-ArrivalTime: 2002-12-27 06:30:33 PST
From: "Jack" <pjacek@softhome.net>
Newsgroups: borland.public.interbase.sql
Subject: Simple SELECT question
Date: Fri, 27 Dec 2002 11:25:35 -0300
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700
NNTP-Posting-Host: 200.75.9.98
Message-ID: <3e0c6151@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1040998737 200.75.9.98 (27 Dec 2002 06:18:57 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed-west.nntpserver.com!hub1.meganetnews.com!nntpserver.com!telocity-west!DIRECTV!203.109.225.2!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail