Mysql return one single row from result NOT EXISTS (multi row return)

86 Views Asked by At

I really can't deal with this piece of code ... I need help ... I searched on the forum but no topic about return 1 row < multi row

Here it is in a for loop:

for (global.id_increment = 0; global.id_increment < global.max_increment; global.id_increment++)
{
     q = GMSQL_QueryExecute(db,
            "INSERT INTO Users (id, name, password, age)
             SELECT " + string(global.id_increment) + ",'User', 'Pass', 14
             FROM dual
             WHERE NOT EXISTS (
                SELECT id
                FROM Users
                WHERE Users.id = " + string(global.id_increment) + "
                LIMIT 1
            )
     ");      
}
  • GMSQL_QueryExecute is a DLL for GMS
  • This script is affected to a sprite (object) for adding row in empty id.row

more explained

ID Users :  01   02   03   04   05   06   07   08   09   (all rows)
            01   02        04   05   06             09   (case empty)
                     03                  07   08         (query actual return)
                     03                                  (the return searched :
                                                       the "first match" enable)

I don't know why LIMIT 1 doesn't work

So I really need help


How to deal with it?

0

There are 0 best solutions below