0

When I execute this SQL query:

INSERT INTO archi(nodo1,nodo2)
SELECT p.nodo,p2.nodo 
FROM polinodo p,polinodo p2 
where p.way=p2.way and p.idpolinodo!=p2.idpolinodo and p.idpolinodo=p2.idpolinodo-1 
and p.way in 
    (SELECT idtag_way 
    FROM tag_way_min where k='highway' and 
    idtag_way in (SELECT idtag_way 
                FROM tag_way_min where k='oneway' and (v=1 or v='true' or v='yes')) )

I receive the following error:

Error Code: 1292. Truncated incorrect DOUBLE value: 'yes'

How can I fix this?

Thanks.

Xearinox
  • 3,224
  • 2
  • 24
  • 38
user2296223
  • 1
  • 1
  • 1

2 Answers2

0

It seems that the column v in your table tag_way is numeric, so this part of your where clause appears invalid:

(v=1 or v='true' or v='yes')

Try and modify that part so the conditions match your data type.

BellevueBob
  • 9,498
  • 5
  • 29
  • 56
0

There seems to be a logic problem with asking to retrieve two values for column k from the same row that are different,

(SELECT idtag_way 
FROM tag_way_min where k='highway' and 
idtag_way in (SELECT idtag_way 
            FROM tag_way_min where k='oneway' and (v=1 or v='true' or v='yes')

I don't see how k can be equal to two values. Perhaps change it to this:

(SELECT idtag_way 
FROM tag_way_min where k='highway' or k='oneway'
idtag_way in (SELECT idtag_way 
            FROM tag_way_min where v=1 or v='true' or v='yes')
Snake_Plissken
  • 390
  • 1
  • 4
  • 14