• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

join 2 tables

Guest
Oct 20, 2006 Oct 20, 2006

Copy link to clipboard

Copied

Hi i have 2 table

**TimesTable**
TimesID
Times


**ClientsTable**
ClientID
AppTimeID
Name

what i want to do is show all the "Times.Times" in a list which i have done with a cfoutput query

then if "ClientsTable.AppTimeID" matches the "Times.Times" show it next to the time in the output

ie
08:00 John
09:00
10:00 Paul
11:00

do i need to join the query or use a cfif tag?
TOPICS
Advanced techniques

Views

368

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006

Copy link to clipboard

Copied

A join should work:

SELECT t.TimesID, t.Times, c.ClientID, c.AppTimeID, c.Name
FROM TimesTable t
LEFT JOIN ClientsTable c
ON t.Times = c.AppTimeID
ORDER BY t.Times


--
Ken Ford
Adobe Community Expert
Fordwebs, LLC
http://www.fordwebs.com


"JohnGree" <webforumsuser@macromedia.com> wrote in message
news:ehaeug$57l$1@forums.macromedia.com...
> Hi i have 2 table
>
> **TimesTable**
> TimesID
> Times
>
>
> **ClientsTable**
> ClientID
> AppTimeID
> Name
>
> what i want to do is show all the "Times.Times" in a list which i have
> done
> with a cfoutput query
>
> then if "ClientsTable.AppTimeID" matches the "Times.Times" show it next to
> the
> time in the output
>
> ie
> 08:00 John
> 09:00
> 10:00 Paul
> 11:00
>
> do i need to join the query or use a cfif tag?
>


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006

Copy link to clipboard

Copied

Suggestion John, learn about many to many relationships.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006

Copy link to clipboard

Copied

Dan,

IMO telling someone to learn about something does not help them much.
Giving them a place to look for the answer would be much more helpful.

BTW I think it would be a one-to-many relationship since he has one times
table record that can be in many clients table records.

--
Ken Ford
Adobe Community Expert
Fordwebs, LLC
http://www.fordwebs.com


"Dan Bracuk" <webforumsuser@macromedia.com> wrote in message
news:ehahk6$8hu$1@forums.macromedia.com...
> Suggestion John, learn about many to many relationships.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Oct 20, 2006 Oct 20, 2006

Copy link to clipboard

Copied

LATEST
It would become a many-to-many relationship if he was to allow a client to have more than one App time (which I assume is some kind of appointment time), at which time he would want to consider migrating AppTimeID and ClientID to an associative entity.

Phil

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation