Hi,
I'm converting some Oracle sql statements to MSSQL, like this:
1 groups
group_start= 0, group_end=18
SELECT DISTINCT assoc.* FROM ign_an.assoc assoc WHERE assoc.orid in (320023 320049, 320065) AND assoc.phase NOT IN ('NLR','NP')
SELECT DISTINCT a.sta,a.time,a.arid,a.chan, a.azimuth,a.slow,a.amp,a.per,a.fm,a.snr,a.auth,a.commid, NVL(TRANSLATE(x.clip,x.clip,'a'),'m') picktype FROM ign_an.arrival a, ign_an.assoc assoc, ign_an.arrival x, ign_an.origin o WHERE a.arid = assoc.arid and a.arid=x.arid(+) AND o.orid=assoc.orid AND assoc.phase not in ('NLR','NP') AND o.orid in (320023 320049, 320065) AND o.time between 1016339182.348640 - 1 and 1016476207.200850 + 1
SELECT DISTINCT stamag.* FROM ign_an.stamag stamag WHERE stamag.orid in (320023 320049, 320065) and stamag.magdef='d'
SELECT DISTINCT netmag.* FROM ign_an.netmag netmag WHERE netmag.orid in (320023 320049, 320065)
SELECT DISTINCT origerr.* FROM ign_an.origerr origerr WHERE origerr.orid in (320023 320049, 320065)
SELECT DISTINCT remark.* FROM ign_an.remark remark WHERE remark.commid in (64599, 64600, 64617, 64601, 64580, 64581, 64603, 64606, 64608, 64607, 64611, 64615, 64613, 64618, 64619, 64626, 64621, 64623)
SELECT DISTINCT amplitude.* FROM ign_an.amplitude amplitude, ign_an.assoc assoc WHERE amplitude.arid = assoc.arid AND assoc.orid in (320023 320049, 320065)
SELECT s.sta,s.chan,i.ncalib,i.ncalper,s.time,s.endtime
FROM ign_an.sensor s, ign_an.instrument i
WHERE s.inid=i.inid
AND lower(substr(s.chan,1,1)) IN ('b','s','e')
AND lower(substr(s.chan,2,1))='z'
AND s.sta NOT IN ( SELECT sta FROM ign_an.beamaux beamaux )
ORDER BY s.chan
SELECT DISTINCT orid, time, origin.commid FROM ign_an.origin origin, ign_an.event e where origin.evid = e.evid and origin.orid != e.prefor and e.evid in (select evid from ign_an.origin where orid in (320023 320049, 320065))
As you can see, the statement make n selects, and return everything within one row (command groups)
Thanks again for your help
Dv