> & "set c1 = (datediff('d',a1,x) from A,B,C)" _> & "select datediff('d',a1,x) " _datediff 関数の第2引数、第3引数は日付ですよ。x は数値(日数)ではないですか?関数を良く調べましょう。