Select to view content in your preferred language

QueryDef problem

962
5
02-26-2013 05:56 AM
pabloberlanga_jimenez
Deactivated User
Hi!

I'd like to code a "self join query" with IQueryDef.
I'm using 9.3 sp2.

The SQL query is somethig like this:

SELECT ID
FROM MY_TABLE a, MY_TABLE b
WHERE a.id = b.id
AND a.date_1 = b.date_2

I have problems to do it since I cannot use alias in QueryDef.
Any ideas? Thank you in advance!
0 Kudos
5 Replies
VinceAngelo
Esri Esteemed Contributor
You can accomplish this with Query Layers (at 10.x), but the query itself doesn't really make sense --
it's logically equivalent to "WHERE date_1 = date_2".

- V

BTW: The last 9.3 service pack was SP1 (followed by 9.3.1, which had two SPs).
0 Kudos
pabloberlanga_jimenez
Deactivated User
It is 9.3.1 you're right.

But I think the query has logic:

SELECT id
FROM table a, table b
WHERE a.id = b.id
AND a.start_date = b.end_date

id       |      start_date      |   end_date   | more data....
181    |      01/02/2012    |   30/02/2012  | ...
181    |      01/01/2012    |   01/02/2012  |  ...

I would get this 181.

Thanks for you attention!!! 🙂
0 Kudos
pabloberlanga_jimenez
Deactivated User
It is 9.3.1 you're right.

But I think the query has logic:

SELECT id
FROM table a, table b
WHERE a.id = b.id
AND a.start_date = b.end_date

id       |      start_date      |   end_date   | more data....
181    |      01/02/2012    |   30/02/2012  | ...
181    |      01/01/2012    |   01/02/2012  |  ...

I would get this 181.

Thanks for you attention!!! 🙂



If I launch the query in SQL Server I get the waited results But If I construct the QueryDef and I evaluate it, it returns Nothing.
0 Kudos
VinceAngelo
Esri Esteemed Contributor
The ArcObjects forum is a better place to discuss this, but I doubt you're using the
correct object to accomplish a self-join.

- V
0 Kudos
pabloberlanga_jimenez
Deactivated User
Ok. I move the question to the correct place.

Thank you again.
0 Kudos