 |

04-21-2005, 03:02 PM
|
|
Centurion
|
|
Join Date: Jan 2003
Posts: 118
|
|
SQL JOIN problem...
|
Hello...
Is it possible to join 1 table data into 2 collumns in one query like this:
Code:
"SELECT Prevozi.PriimekIme, Prevozi.UlicaSt, Prevozi.Kraj, " & _
"Prevozi.UraStart, Prevozi.UraPrihod, Prevozi.UraCilj, Voznikisif.Voznik_sif, " & _
"Tehnikisif.Tehnik_sif, Relacijesif.Kraj_sif, " & _
"Statussif.Status_sif, Prevozi.Osebe, Prevozi.Km, Prevozi.VoziloSt, " & _
"Prevozi.VoziloReg FROM ((((Prevozi INNER JOIN Voznikisif ON " & _
"Prevozi.Voznik = Voznikisif.ID) INNER JOIN Tehnikisif ON " & _
"Prevozi.Spremljevalec = Tehnikisif.ID) INNER JOIN Relacijesif ON " & _
"Prevozi.RelacijaOd = Relacijesif.ID) INNER JOIN Relacijesif ON " & _
"Prevozi.RelacijaDo = Relacijesif.ID) INNER JOIN Statussif ON " & _
"Prevozi.KoncnoStanje = Statussif.ID WHERE Datum =" & Date
It says invalid Join expression...
Thanks,
Erik
|
|

04-21-2005, 03:50 PM
|
 |
Village VB Idiot
* Expert *
|
|
Join Date: Jan 2003
Location: Idaho
Posts: 1,850
|
|
|
Could you print the query out in the debugger and post that?
Also, if you're testing a Date value, then your WHERE clause will not be correct.
|
__________________
"What am I supposed to do with all my great ideas? Put 'em in a tub and clean myself with them? That's what soap is for, Lois."
Peter Griffin - The Family Guy
|

04-22-2005, 12:04 AM
|
|
Centurion
|
|
Join Date: Jan 2003
Posts: 118
|
|
Quote:
|
Could you print the query out in the debugger and post that?
|
Can you explain what do you mean? ... I'm some kind of beginner 
|
|

04-22-2005, 08:18 AM
|
 |
Village VB Idiot
* Expert *
|
|
Join Date: Jan 2003
Location: Idaho
Posts: 1,850
|
|
__________________
"What am I supposed to do with all my great ideas? Put 'em in a tub and clean myself with them? That's what soap is for, Lois."
Peter Griffin - The Family Guy
|

04-22-2005, 04:12 PM
|
 |
Cum Grano Salis
Retired Moderator * Guru *
|
|
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
|
|
If I understand your question, one table is joined on ONE condition within a query scope. Meaning, if you need to check against two fields in ONE table within a JOIN statement you should restructure your query to do something like:
Code:
SELECT.......
FROM T1 INNER JOIN T2 ON T1.F1 = T2.F1
WHERE T1.F2 IN (SELECT M.F2 FROM T1 M WHERE...etc.)
Basically, if you need to check or join one table on two conditions, you can create a sub query aliasing the same table and do your condition check there.
|
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown
|

04-24-2005, 04:51 AM
|
|
Centurion
|
|
Join Date: Jan 2003
Posts: 118
|
|
|
I see, I'll try.... I will respond
|
|

04-24-2005, 03:00 PM
|
|
Centurion
|
|
Join Date: Jan 2003
Posts: 118
|
|
Code:
"SELECT .... FROM ((Table1 INNER JOIN Table2 ON " & _
"Table1.Voznik = Table2.ID) INNER JOIN Table3 ON " & _
"Table1.RelacijaOd = Table3.ID) INNER JOIN Table3 ON " & _
"Table1.RelacijaDo = Table3.ID WHERE Name = " & txtName.txt
In the code above I have for Table3 two conditions, and I have WHERE condition for name .... how should I put this second Table3 condition in sub query.... it says invalid Join expression
I have problem with this query for about a month... 
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|