Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
aden
Starting Member
23 Posts |
Posted - 2006-09-20 : 14:41:35
|
how can i join 3 tables with the same key like accountno?what if only two of them have the same key? |
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2006-09-20 : 14:50:04
|
Table definitions, please..."I have HAD it with these muthu-f$#%in' cursors in my muthu-f$#%in' database!" |
 |
|
aden
Starting Member
23 Posts |
Posted - 2006-09-20 : 14:58:55
|
enough is enoughconthistUSERID String 8 UserACCOUNTNO String 20 Account numberSRECTYPE String 1 First character of RecType (A record type code identifying different types of records within the database)RECTYPE Sting 10 Record typeONDATE Date 8 Action dateONTIME String 5 Action timeACTVCODE String 3 Activity codeSTATUS String 2 First character is flag, second equals 1 if notes exist.contact1ACCOUNTNO String 20 Account numberCOMPANY String 40 Company name CONTACT String 40 Contact nameLASTNAME String 15 Contact's last nameDEPARTMENT String 35 DepartmentTITLE String 35 Contact titleSECR String 20 SecretaryPHONE1 String 25 Phone 1PHONE2 String 25 Phone 2PHONE3 String 25 Phone 3 contact2ACCOUNTNO String 20 Account number CALLBACKON Date 8 Call back date CALLBACKAT String 8 Call back time (unused compatibility field) CALLBKFREQ Smallint 3 Call back frequency LASTCONTON Date 8 Last contact date LASTCONTAT String 8 Last contact time LASTATMPON Date 8 Last attempt date LASTATMPAT String 8 Last attempt time MEETDATEON Date 8 Meeting date MEETTIMEAT String 8 Meeting time i need to compan.comtact1, callbackon.contact2, status.conthist |
 |
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2006-09-21 : 12:53:39
|
Apparently enough is insufficient.If you cannot be bothered to explain the problem clearly and completely, then why should anybody respond to help you? I, and others, are willing to spend some time helping you solve your problem, but we do not want to waste our time trying to guess what the problem is.This:how can i join 3 tables with the same key like accountno?what if only two of them have the same key? ...and this:i need to compan.comtact1, callbackon.contact2, status.conthist ...are not parsable statements in SQL, VB, English, or any other language.And "string" is not a datatype. |
 |
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2006-09-21 : 15:27:53
|
blindman, that's hilarious! But let's put aden out of their misery  SELECT contact1.company, contact2.callbackon, conthist.statusFROM conthistINNER JOIN contact1 ON contact1.accountno = conthist.accountnoINNER JOIN contact2 ON contact2.accountno = conthist.accountno |
 |
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2006-09-21 : 16:44:46
|
If I was sure that was what he wanted, I'd have suggested it already. I'm just not into playing guessing games on the forums anymore. Too many bad experiences spending hours trying to figure out what a person wants, when they are unwilling or unable to take the time to explain their requirements clearly.I hope for aden's sake that your code solves his problem."Once you establish possibility, all that remains are desire and determination." |
 |
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2006-09-21 : 16:57:58
|
That's why you're the Aged Yak Warrior and I'm just the rookie |
 |
|
|
|
|
|
|