Error while inserting date – Incorrect date value:

As MySql accepts the date in y-m-d format in date type column, you need to STR_TO_DATE function to convert the date into yyyy-mm-dd format for insertion in following way: INSERT INTO table_name(today) VALUES(STR_TO_DATE(’07-25-2012′,’%m-%d-%Y’)); If you want to select the date in different format other than Mysql format, you should try DATE_FORMAT function SELECT DATE_FORMAT(today, ‘%m-%d-%y’) … Read more

Improving query speed: simple SELECT in big postgres table

Extracting my comments into an answer: the index lookup here was very fast — all the time was spent retrieving the actual rows. 23 seconds / 7871 rows = 2.9 milliseconds per row, which is reasonable for retrieving data that’s scattered across the disk subsystem. Seeks are slow; you can a) fit your dataset in … Read more

how to convert sql union to linq

Three useful Linq concepts operating on sets. Given set c and set e: Concat gives you everything in c or e: (From c In db.Customers Select c.Phone).Concat( _ From c In db.Customers Select c.Fax).Concat( _ From e In db.Employees Select e.HomePhone) (From c In db.Customers _ Select Name = c.CompanyName, Phone = c.Phone).Concat(From e In … Read more

Dynamically create columns sql

You will want to use a PIVOT function for this. If you have a known number of columns, then you can hard-code the values: select name, [Bronze], [Silver], [Gold], [Platinum], [AnotherOne] from ( select c.name, cr.description, r.typeid from customers c left join rewards r on c.id = r.customerid left join customerrewards cr on r.typeid = … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)