MonthFebruary 2014

Friday pint talks with fellow inhouse developers

X:- Hey, we’ve recently launched a cool piece of NDA in our proprietary NDA.
Y:- Sounds great. How did you manage to prototype it?
X:- Well, we took some NDA, with NDA, cuz the first one had some problems with caching, and with some NDA, we got this NDA to work!
Y:- Why did you use this NDA, when NDA we use in the company does NDA better, it’s more NDA, NDA and NDA that this!

Open-source helps people socialise! 😉

SQL reinsert row in the same table

Seems that we have a competitor to “export to csv” SQL query that I keep forgetting every time I need to export something in the CSV file.

The second nominee is reinserting the row into the same database but with a new primary key.

YOURID - source record# yourtable - target table;
CREATE TEMPORARY TABLE tmp_table SELECT * FROM yourtable WHERE id=YOURID;
SELECT @new_id:=((SELECT id FROM yourtable ORDER BY id DESC LIMIT 1) + 1);
UPDATE tmp_table SET id=@new_id WHERE id = YOURID;
INSERT INTO yourtable SELECT * FROM tmp_table WHERE id=@new_id;

© 2018 Andy's Cave

Theme by Anders NorénUp ↑