Sie sind auf Seite 1von 11

syntax

Can anyone comment on why this query does not work? ty

Insert into kss_temp_person


select combhomeacct.effectivedtm, combhomeacct.expirationdtm, jaids.ppstartdatedtm,
jaids.npenddatedtm
from jaids
join combhomeacct on jaids.employeeid = combhomeacct.employeeid
and ((combhomeacct.effectivedtm =< jaids.ppstartdatedtm and combhomeacct.expirationdtm >=
jaids.npenddatedtm + 7
or combhomeacct.effectivedtm >= jaids.ppstartdatedtm and combhomeacct.expirationdtm <=
jaids.npenddatedtm + 7
or combhomeacct.effectivedtm <= jaids.ppstartdatedtm and combhomeaccount.expirationdtm >=
jaids.ppstartdatedtm
or combhomeacct.effectivedtm <= jaids.npenddate + 7 and combhomeacct.expirationdate >
jaids.npenddate + 7));

Latest page update: made by IvanOrlinsky , Mar 10 2010, 11:13 AM EST (about this update
IvanOrlinsk syntax help - IvanOrlinsky
y 67 words added

- complete history)
view changes
Keyword tags: None

Share this

Threads for this page

Started B
Thread Subject Replies Last Post
y

robheus Re: syntax 0 Apr 29 2010, 4:15 AM EDT by


robheus

Thread started: Apr 29 2010, 4:15 AM EDT  Watch


  Look under syntax of SQL SELECT statement for exact syntax.

You use the word JOIN, but the join condition is simply part of the WHERE clause,
and you need to specify the table to join in the WHERE clause.

And please re-evaluate your long conditional statement. You supplied double
parentesis, (the " (" and " )" characters), but that doesn't make the statement any
sounder. Please consider the order of evaluation of a combination of AND and OR
clauses. You might get the wrong condition.

For clarity, and to show the intended behaviour, use parenthesis of subexpresions
in conditions.
for example:

Instead of:

A and B or C

either say

A and (B or C)

or

(A and B) or C

Depending on what you intended


Keyword tags: sql syntax
Post reply

 Post a new thread


Showing 1 of 1 threads for this page
Ktp RT 7

Das könnte Ihnen auch gefallen