SELECT C.IDstate, C.IDcity, A.IDadress
FROM address AS A
JOIN city AS C on C.IDcity = A.IDcity
WHERE C.IDstate = ?
I am getting the state id nore than once
If you don't need random sorted result in SQL, you should use ORDER BY.
This example use 3 columns to order.
ExecuteSQL ( "
SELECT state, SId, 0 , 0
WHERE SId = ?
SELECT city, S.SId, C.CId, 0
FROM State AS S, City AS C
WHERE S.SId = ? AND S.SId = C.SId
SELECT address, S.SId, C.CId, A.AId
FROM State AS S, City AS C, Address AS A
WHERE S.SId = ? AND S.SId = C.SId AND C.CId = A.CId
ORDER BY 2,3,4
" ; ""; ""; 1;1;1)
Ok it works. Need to adapt to my system
Got it to work. Had trouble since I was using Text Fields for my ID's. It returned all 4 columns. I really need to first column so I used a CF to clean it up