![]() ![]() So, at first you generate a batch of commands: SELECT CONCAT(' DELETE FROM erp_quoting WHERE id_workorder=', id_workorder, ' AND date_quoted!=', MAX(date_quoted)) But what I sometimes do in such situations is to generate a batch of DELETE queries, copy these with a simicolon between them and run them separately. I have no idea how to do that in a single query. ( SELECT ` name` FROM crm_customer WHERE id_primary = t1.id_customer) AS ` Customer Name`, Thank you to anyone who can help!! SELECTĬAST( IFNULL( FROM_UNIXTIME( IF(t1.date_quoted=0, NULL,t1.date_quoted), ' %Y-%m-%d'), 0) AS DATE) AS ` Date Quoted`, Basically if there is a duplicate WO# remove the duplicate row (keeping the first occurance) so I only get unique id_workorder (WO#) numbers - see attached picture for desired result. I wrote the below Query but was wondering if there was a way to remove duplicate lines from the data based on id_workorder (WO#). Hello All, I am very new to HeidiSQL and am still fumbling my way around. Ģ1 Nov - yucikala: show tree on connection listĢ1 Nov - designlee: PostgreSQL does not show databasesĢ0 Nov - franckcdr: Change charset encoding Postgres win1252ġ6 Nov - ansgar: Issues through PowerShellġ6 Nov - jesussmd: Cambio de vista al agregar una fila Ģ1 Nov - ringoaniki2021: Heidisql Error: An error occurre. Ģ2 Nov - notHeidi: Reset numbering of rowsĢ2 Nov - ringoaniki2021: SQL Error : /* SQL Error (1146). Ģ7 Nov - jgo: Fields PERSISTENTES y VIRTUAL.Ģ7 Nov - chengj: Data grid frame is hidden after reducing. Ģ9 Nov - ansgar: Add a line, change the view to the first. ģ0 Nov - Kcko: Adding filter into "database explorer. If yes, you inform the user about their error.03 Dec - jlevitas16: can't edit rows or perform sele. If mysql query failed, you check the error code.īased on errror code, you determine whether the unique key stopped the insert. You can do the following then: allow the user to insert and then check whether mysql query succeeded. The other problem was partially solved by guido2004 - if you don’t want duplicate entries within database, you use unique key. Third problem is that your code will be slow as your database grows, and you have to manually start the script every now and then. In terms of SQL: DELETE FROM jobs WHERE desc='some desc' AND id NOT IN(1) You don’t limit your delete to 0 records or 1 record, you delete everything that has the same description as current row EXCEPT the current row. Second problem is that the query issued for deleting is incredibly bad. The actual job does not get deleted though… any help is welcomeįirst problem you have is that you haven’t connected to MySQL and you’re issuing queries. Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/netboomy/public_html/ACCOUNTS-ASSISTANT-JOBS.CO.UK/rdup.php on line 18 where I run the script here is an example output I’ve tried to modify the below code to suit my need but I’m getting an errorĪlso not sure why $link is there for, I’ve tried it with and without. Some people submit the same job twice and I need to delete the duplicates. ![]() ![]() ![]() Hey guys, I have database of job descriptions. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |