0
+----+------------+------------+------------+----------+
| id | phone_no   | join_date  | city       | blood_gp |
+----+------------+------------+------------+----------+
|  1 | 80077672xx | 1997-07-19 |  Delhi     | NULL     |
|  2 | 80077642xx | 1998-07-19 | New Delhi  | NULL     |
|  3 | 80477642xx | 1999-07-19 | Mumbai     | NULL     |
|  4 | 80077654xx | 1997-05-31 | Kolkata    | NULL     |
+----+------------+------------+------------+----------+

I want to enter all the blood groups at once . Is there a way to do so ?

Matt
  • 14,906
  • 27
  • 99
  • 149
Varad Bhatnagar
  • 599
  • 1
  • 7
  • 19

2 Answers2

1

you can use single query with select and update

UPDATE table1 , (SELECT * FROM table2 where 1) src 
  SET table1.blood_gp = src.filed2 where 1 ;

if you want to insert multiple row data using single query then use this code

INSERT INTO yourtable (x,y,z) VALUES (a1,a2,a3), (b1,b2,b3);

or if you want to update one column value all filed then use this code

update yourtable set blood_gp = 'yourvalue' where 1;

if any problem then inform me

Shafiqul Islam
  • 5,570
  • 2
  • 34
  • 43
0

Just make an update query without where clause.

update table set blood_gp = 'value'

That's generalize query.

MD Ruhul Amin
  • 4,386
  • 1
  • 22
  • 37