121 Posts
deralex
7 years ago
1
Topic

Hi,

I need a free SQL select, that contains something like:

SELECT myid AS value, mytext AS text
FROM #__table1 AS a, #__table2 AS b
WHERE a.id=[parent]
....

Problem:

a.id is of type INT. But the field seems to set quotes automatically around parent. So my parent of type integer is converted to type string and the SQL call fails.

What can i do?

Greez

Alex

Get a VIP membership
4229 Posts
Kadministrator
7 years ago
0
Level 1

You could use https://dev.mysql.com/doc/refman/5.7/en/cast-functions.html#function_cast to cast it to int , but I doubt the problem is in quotes, it should work regardless of that. You are joining 2 tables without specifying join fields, also your field names are without aliases - this query can't be sucesfull as it is impossible form mysql to know which row is the right one.

Get a VIP membership