bandi94 Posted August 12, 2013 Share Posted August 12, 2013 I need to select a row , from a table but with 3 conditions. Something like this executeSQLQuery("SELECT value,day FROM Bank WHERE account_name=? , value=?,day=? ", getAccountName(acc),value_d,day_d) But how i tought it's not working like this. It is possible to make this ?? Or i need to select them only from the AccountName and after with loop ,sort them after the received data/values ? EDIT: Ohh i just found out that i need to put "AND" , problem solved Link to comment
tosfera Posted August 12, 2013 Share Posted August 12, 2013 haha yeah its AND. Without SQL knowledge it might be a entirely new world for you. This might be interesting to look at as an example; local id = executeSQLQuery("SELECT COUNT(ID) as 'id_' FROM player_vehicle") insert = executeSQLQuery("INSERT INTO player_vehicle(ID, modelID,color1,color2,color3,color4,vehicleOwner, vehicleHealth, saveX, saveY, saveZ, saveRX, saveRY, saveRZ, spawned, fuel) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", id[1].id_, modelID, color_1, color_2, color_3,color_4, accName, "1000", 1464.8820, 748.1798, 11.5, 0, 0, 90, 1, 100 ) Link to comment
bandi94 Posted August 12, 2013 Author Share Posted August 12, 2013 Yah it's kinda new world for me I hit another problem : I am saving bank deposit's , every deposit has a time in witch it can't be withdrawed. Now when i deposit 2 time's (one after another) the same amount of money for same amount of day's , i will have a duplicated row : ( myname , 1000 , 5 ) ( myname , 1000 , 5 ) this is fine bk i wanna keep every deposit separately, But when it come's the time of withdraw , i need to delete the row , but here come's the problem both of the row's will be deleted bk there are the same , but i wanna delete only one of them. Is this possible or i need to insert one more column with the "deposit number (ID)" and use that for delete ? Link to comment
Sasu Posted August 12, 2013 Share Posted August 12, 2013 In the wiki you have examples. executeSQLQuery("UPDATE players SET color=?,sound=? WHERE name=?", colorName, soundName, playerName) Link to comment
bandi94 Posted August 12, 2013 Author Share Posted August 12, 2013 In the wiki you have examples. executeSQLQuery("UPDATE players SET color=?,sound=? WHERE name=?", colorName, soundName, playerName) I don't wanna update anything , i wanna delete only one of the row's (from the duplicates) and not all of them. Link to comment
Sasu Posted August 12, 2013 Share Posted August 12, 2013 Oh. I think that you have to create one more column which will be the deposit ID. Link to comment
bandi94 Posted August 12, 2013 Author Share Posted August 12, 2013 THX. Well yah i added one more column with the ID. And using the ID when i am removing the row . Link to comment
tosfera Posted August 12, 2013 Share Posted August 12, 2013 Sorry for my late respond. The first thing you will have to learn while doing SQL is the Auto Increment type. The ID field is an AI field, it keeps counting whigher and higher with steps from 1 (default). All rows will become unique because of the AI. Easy to delete rows like that! Link to comment
bandi94 Posted August 12, 2013 Author Share Posted August 12, 2013 Sorry for my late respond. The first thing you will have to learn while doing SQL is the Auto Increment type. The ID field is an AI field, it keeps counting whigher and higher with steps from 1 (default). All rows will become unique because of the AI. Easy to delete rows like that! pfuu. thx mate. I made a whole function to keep ID's growing up one by one , when a simpel " ID INTEGER PRIMARY KEY AUTOINCREMENT," make's all the jobb Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now