>Can we build SPT using the SQLEXEC(x,SELECT...,) that has multi join conditions on the WHERE?
>
>I created many WHERE conditions within a Remote View & wanted to paste the SQL into a .prg to use with SPT. I have a smaller sample of code below...it has a WHERE AND
>I've tried many times with different multi-conditions but it doesn't work. It works fine with a single WHERE but when I add an "ADD", my SPT .prg won't work? (should be some syntax issue...?)
>
>Is anyone getting this to work? Any examples? Yes, I'm new to SPT but I haven't had this problem on my other non-SPT SQL. Any ideas?
>
>Thanks...
>
>
>LOCAL lnhandle
>lnhandle = SQLCONNECT("Fnxpro1")
>
>SQLEXEC (lnhandle,"SELECT Fltrade.TRCUS, Fltrade.TRTAM, Fltrade.TRTDTE, Fltrade.TRCAM,;
> Fltrade.TRCSQ, Fltrade.TRCPC, Fltrade.TRCNF, Fltrade.TRDST, Fltrade.TRCAT,;
> Fltrade.TRRAN, Fltrade.TRPDTE;
> FROM FUNDLINX.FLTRADE Fltrade;
> WHERE {fn month(Fltrade.trtdte)} >= ?ccMonth;
> AND Fltrade.TRCAT <> 'VARIC'")
I had used SPTs extensively (for both type of back-ends VFP & Oracle). You can use WHERE clause also for Join (except outer join in VFP where you need to use OUTER JOIN clause, but in Oracle (+) clause) along with your normal filter expressions.
In your above query I did not understand one part which is {fn month(Fltrade.trtdte)}. What is this "fn" declaration? Does it mean function month defined as a stored procedure? What is your back-end? (Of course, I have not worked with SQL server as back-end).
If you cannot find a decent way to get around with then I can suggest another way. Use "Between" clause with starting date of the month and ending date of month. In that case you can avoid using stored procedure with AND clause.
Regards
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement