two id's working together..?

Forum for anything hard- or software related.

Moderator: Moderators

Post Reply
keffo
hit the ground hard, real hard
Posts: 80
Joined: Sun Dec 21, 2003 9:10 pm
Location: se

two id's working together..?

Post by keffo »

Hmm.. Im stuck. Cant think it logic..

Hey.

Im re-writing some of this script, hmm. the first is, that.. I have one table for the results and one for the claninfo.

Results & Clans.

In Clans i use cid instead of Results id, but the thing is. when you check teh report i want the right clan (cid?) to fit with the result.

do you get it? how do i do? :> Ive written a add script and so, and it works fine.. now i need to know how to get the right clan info into the "report" stuff.

Cheers
Eg har blitt norrbagge :<
tyldis
sank like a rock
Posts: 106
Joined: Sat Oct 25, 2003 12:39 pm
Location: no
Contact:

Post by tyldis »

Not sure I follow you, but I think you might want to read up on joins.

Example tables (underline denotes primary key):
clans(ClanID,ClanName,ClanWebsite)
results(MatchID,ClanID,ScoreUs,ScoreThem)

Example SQL:
SELECT * FROM results LEFT JOIN clans ON results.ClanID = clan.ClanID;

That should match the clan with the match.

Untested code at 6 AM!

Edit: And lo and behold an obvious error spotted and corrected.
Down, not across.
iler
special poika polizai
Posts: 78
Joined: Mon Jul 28, 2003 9:19 am
Location: fi
Contact:

Post by iler »

Or just like this.

SELECT * FROM results, clans WHERE results.ClanID = clan.ClanID, ORDER BY MatchID DESC;
paino on voimaa, ylipaino on ylivoimaa BD http://www.clanunited.org
Post Reply