|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hy ...
i have a table whith : ID | Stuff ------------- 1 | First 2 | Second 3 | Third . . . I want to delete from a table 20 or 50 rows at once after the ID . How can I do that ..??? THANX !!!
__________________
The future is on ... development . |
|
#2
|
||||
|
||||
|
You'll have to give more information than that. What type of database are you using? When you say '20 or 50 rows' are you trying to delete just the first 20/50 rows or are you trying to delete rows with specific IDs?
__________________
~ishnid; Have you tried: [ search.cpan.org | perldoc | Java API | mysql.com | google ] Apostrophes are NOT used for possessive pronouns or for noun plurals, including acronyms. |
|
#3
|
|||
|
|||
|
Yes I want to delete with specific IDs like :
from 10 to 60 ..... or somwetring likke that .. |
|
#4
|
||||
|
||||
|
delete from your_table where id between 10 and 60
|
|
#5
|
|||
|
|||
|
yes ...
nice oane ,.,..thanks ..:wink:But now if insted of the ID I have a date field where the date is save in (Ymd) format ... Like this ... 20030827 ... how can I delete multiple rows from the table after the year desired from the field data ... Sopsed that I have like this : Date | Stuff ------------- 20030810 | First 20031211 | Second 20040103 | Third . . . So from this table I want to delete the rows that have been retteen in the 2003 year and ofcourse starts with 2003 ... How can I do that ...???? THANX !!! |
|
#6
|
||||
|
||||
|
What type is the field? Date, (var)char, int?
|
|
#7
|
|||
|
|||
|
The fild is varchar(50) , and I put the date there with php
... date(Ymd); ..HOw can I delete the rows(al of them) that bigins with 2003 ... ??? That is my question... |
|
#8
|
|||
|
|||
|
have you tried something like...
DELETE FROM db WHERE (varchar(50) LIKE "2003%"); ^ || || or date |
|
#9
|
||||
|
||||
|
bar5cent's suggestion should work (delete from db where date_column like '2003%') or you can use your database's substring function also.
delete from db where substring(date_column,1,4) = '2003' On another note, I would suggest that you put dates in date fields instead of varchar or integer, etc... |
|
#10
|
|||
|
|||
|
Thanx !!!! bar5cent
THAT REALY HELPED ... ![]() |
![]() |
| Viewing: Dev Shed Forums > Other > Beginner Programming > How to delete multiple rows |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|