heyyy iam on work of creating a website based on php and mysql to store sales accounts.
my doubt is that, how to make a query that will delete only i data from the table
for example..
I have a table containing many columns.. in some of them data are same.. because i get same type of orders..
BUT Thing is that, sometimes i have to delete only one field frm it. so hw to do tat
if i use basic delete query, lik delte from sales where column1=bla bla column 2equals bla bla..
Then it may delete all similiar datas.. i want tto remove only i row of data at a time.
how to do that ?
Copyright © 2024 Q2A.ES - All rights reserved.
Answers & Comments
Verified answer
Try using a select first sub query such as -
delete from sales where column1 = (SELECT FIRST(column1) FROM sales where column1 = 100).
http://www.w3schools.com/Sql/sql_func_first.asp - for more information
better efficient to decide on your archives on your software, ascertain that you're deleting the astonishing archives and delete them one via one. once you've better than one man or woman having access for your archives on your software, they'd nicely be writing to the record once you're deleting the finest quantity and it can make your command risky you may want to decide on a huge decision id's, positioned them right into a comma separated string of id's and execute the command "delete from table the position id in ('id1','id2',and so on)" really than executing the delete command for each merchandise.
In a well designed DB every table should have unique key, if yours don't have one then I suggest you read MySQL docs and look for rowID/columnID or similar.
"sometimes i have to delete only one field" - you probably meant one record, not field.