Data de postagem: May 18, 2010 8:56:48 PM
var recurso = IQuery.from( -2007800000 /* Recursos */ )
.where({ field: "CHAVE", operator: "=", value: 123 })
var solicitacao = IQuery.from( -1897052056 /* Solicitações */ )
.where({ operator: "exists", value: recurso })
.column("CHAVE")
solicitacao.toSql()
SQL Gerado:
select SOLICITACAO2.CHAVE
from SOLICITACAO SOLICITACAO2
where (
exists ( select 1
from RECURSO RECURSO1
where (
RECURSO1.CHAVE = 123)
and (
RECURSO1.CLASSE in (-2007800000,-2007790000,-1899998716,-1899998715,-1899998714,-1899998713,
-1899998380,-1899998379,-1899998055,-1899998054,-1899936366,-1899936350,
-1899936349,-1899933389,-1899933388,-1899931989,-1899931988,-1898188413,
-1898188412,-1897148139,-1897148138,-1897148136,-1897148107,-1897148105,
-1897131466,-1897053437,-1897053436,-1897053435,-1897053375,-1897053150,
-1897053127,-1897052333,-1897052332,-1897052108,-1897051928,-1897051833,
-1897051170,-1897050921,-1897050920,-1897050834,-1897050565,-1897050477,
-1897048830,-1897048371,-1897048043,-1897048042,-1897048041,-1897047843,
-1897047835,-1895836228,-1895836193,-1895836192,-1894815178,-1894815177,
-1894815176,-1894815082,-1894815081,-1894765217,-1894743905,-1894743764,
-1894743669,-1894743616,-1894543836,-1894543808,-1894543807,-1894442945,
-1894442712,-1894333991,-1894333967,-1894333966,-1894333962,-1894134133,
-1894134109,-1894134053,-1894134017,-1894134003,133,134,135,140,145,146,
147,148,149,150,151,153,156,157,158,159,162,163,170,184,185,186,187,188,
189,190,202,1933,1934,1937,1938,1939,1940,1941,1942,1943,1944,1945,1946,
1947,1948,1949,1952,1959,1960,1961,1962,1963,1964,1965,1966,1967,1968,
1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,
1983,1984,1985,1986,1991,5059,5403,5414,5421,5422,5427,5428,5430,5431,
5432,5434,5872,5874,12689,38714,52892,52896,52898,52902,52908,52909,
52910,52911,52912,52913,52919,52920,52972,53139,62119,62120,62188,63053,
67026,67418,67419,67611,67612,67613,67614,68153,68157,69046,69050,69051,
69052,71070,82718,139961,139966,163516,163520,163521,163522,172883,173396,
173397,173398,176411,183534,183535,183536,183537,183538,183539,183540,
184174,185833,186076,2635628,2649461,3326356,3489361,3509956,3543770,3543779,
3614115,3742854,3742870,3745694,3745703,3745729,3745738,3870803,3870812,
3870821,3870830,4141102,4213977,4908311,4933393,4933406,4933419,5705198,
6109258,6109278,6109293,6114250,6114266,9842485,15237536,19322136,19322151,
26087951,27479461,35029703,35029725,35029747,35029769,35029791,35029813,
35029835,35029857,35029879,35029901,35029923,35029945,35029967,35029989,
35030011,35030033,35030055,35030077,35431262,35431283,35431304,35431325,
35431346,35441710,35441731,35441752,35441773,35441794,35441815,35441836,
35441857,35441878,35441920,35441941,35453972,35453993,35744652,35744667,
35944512,35944525,35944538,36513158,36593583,36640097,36786106,36786122,
36786138,36915632,36915650,37163088,37200148,37907890,37907908,37929041,
38963812,38963831,38963855,38965225))) )
and (
SOLICITACAO2.CLASSE in (-1897052056,-1897052055,-1897052054,-1897051938,
-1897050453,-1897048578, -1897048577,-1894825103,3930906,35041724))