This seems to be pretty trivial, but I can't make MS work with a query with a JOIN in it.
I have searched the forum and the docs, and I have not found anything that refers to this scenario. My script has a couple of SQL queries using DBQUERY. The first works just fine and returns records. The second will only return any records after I remove the JOIN clause.
It is a very simple query in the form of;
SELECT a.field1 b.field2 FROM table1 a JOIN table2 b ON a.field1 = b.field1 WHERE {some conditions}
I also tried;
SELECT a.field1 b.field2 FROM table1 a, table2 b WHERE a.field1 = b.field1 AND {some conditions}
I have tested both queries directly in SQL and they both work as expected.
I don't get any errors when MS runs the DBQuery line, but I never get any records either.
I could write into the code a loop to duplicate this output, but that seems like is very inefficient and I assume that MS should be able to handle this basic SQL structure.
Any advice or suggestions are welcome.
Thanks!
DBQuery with Join
Moderators: Dorian (MJT support), JRL
- Dorian (MJT support)
- Automation Wizard
- Posts: 1378
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: DBQuery with Join
Can you post the pertinent lines of your script please?
Yes, we have a Custom Scripting Service. Message me or go here
Re: DBQuery with Join
Thanks Dorian,
I found the issue, it was a typo in my SQL code that my SQL program overlooked.
I found the issue, it was a typo in my SQL code that my SQL program overlooked.
- Dorian (MJT support)
- Automation Wizard
- Posts: 1378
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: DBQuery with Join
Aah, excellent!
Yes, we have a Custom Scripting Service. Message me or go here