LMSouq

Knowledge Base

Browse Moodle Solutions

Clear

378 solutions found in general-dev

Page 7 of 19
0 votes
1 ans
3 views
Fastest Way to Find Distance Between Two Lat/Long Points

I currently have just under a million locations in a mysql database all with longitude and latitude information. I am trying to find the distance between one...

general-dev Solved
RY
asked 1 month ago by Ryan Detzel
0 votes
1 ans
3 views
Group by date only on a Datetime column

Having a table with a column like: `mydate DATETIME` ... I have a query such as: SELECT SUM(foo), mydate FROM a_table GROUP BY a_table.mydate; This...

general-dev Solved
FM
asked 1 month ago by fmsf
0 votes
1 ans
3 views
ALTER TABLE to add a composite primary key

I have a table called `provider`. I have three columns called `person`, `place`, `thing`. There can be duplicate persons, duplicate places, and duplicate things...

general-dev Solved
DA
asked 1 month ago by David542
0 votes
1 ans
3 views
Select records from NOW() -1 Day

Is there a way in a MySQL statement to order records (through a date stamp) by >= NOW() -1 so all records from the day before today to the future are selecte...

general-dev Solved
US
asked 1 month ago by user1092780
0 votes
1 ans
3 views
Location of my.cnf file on macOS

I'm trying to follow along [this tutorial](http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html) to enable remote acces...

general-dev Solved
NI
asked 1 month ago by nicolas
0 votes
1 ans
3 views
Which is faster: multiple single INSERTs or one multiple-row INSERT?

I am trying to optimize one part of my code that inserts data into MySQL. Should I chain INSERTs to make one huge multiple-row INSERT or are multiple separate I...

general-dev Solved
DU
asked 1 month ago by dusoft
0 votes
1 ans
3 views
Row count with PDO

There are many conflicting statements around. What is the best way to get the row count using PDO in PHP? Before using PDO, I just simply used `mysql_num_rows`....

general-dev Solved
JA
asked 1 month ago by James
0 votes
1 ans
3 views
Change a column type from Date to DateTime during ROR migration

I need to change my column type from date to datetime for an app I am making. I don't care about the data as its still being developed. How can I do this...

general-dev Solved
JD
asked 1 month ago by jdog
0 votes
1 ans
3 views
If table exists drop table then create it, if it does not exist just create it

I'm stumped, I don't know how to go about doing this. Basically I just want to create a table, but if it exists it needs to be dropped and re-created...

general-dev Solved
GE
asked 1 month ago by George
0 votes
1 ans
3 views
Access Denied for User 'root'@'localhost' (using password: YES) - No Privileges?

I am continuously receiving this error. I am using mySQL Workbench and from what I am finding is that root's schema privileges are null. There are no pri...

general-dev Solved
CH
asked 1 month ago by Chase
0 votes
1 ans
3 views
WHERE vs HAVING

Why do you need to place columns you create yourself (for example `select 1 as "number"`) after `HAVING` and not `WHERE` in MySQL? And are there an...

general-dev Solved
BA
asked 1 month ago by baloo
0 votes
1 ans
3 views
How to alter a column and change the default value?

I got the following error while trying to alter a column's data type and setting a new default value: ALTER TABLE foobar_data ALTER COLUMN col VARCHA...

general-dev Solved
QA
asked 1 month ago by qazwsx
0 votes
1 ans
3 views
Reshape a Table to Convert Rows to Columns

I tried to search posts, but I only found solutions for SQL Server/Access. I need a solution in MySQL (5.X). I have a table (called history) with 3 columns:...

general-dev Solved
BO
asked 1 month ago by Bob Rivers
0 votes
1 ans
3 views
JOIN queries vs multiple queries

Are JOIN queries faster than several queries? (You run your main query, and then you run many other SELECTs based on the results from your main query) I'...

general-dev Solved
AN
asked 1 month ago by Andreas Bonini
0 votes
1 ans
3 views
INSERT ... ON DUPLICATE KEY (do nothing)

I have a table with a unique key for two columns: CREATE TABLE `xpo`.`user_permanent_gift` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT , `fb_u...

general-dev Solved
UF
asked 1 month ago by ufk
0 votes
1 ans
3 views
How to get the count of each distinct value in a column?

I have an SQL table called "posts" that looks like this: id | category ----------------------- 1 | 3 2 | 1 3 | 4 4...

general-dev Solved
JE
asked 1 month ago by Jeff Gortmaker
0 votes
1 ans
3 views
Table is marked as crashed and should be repaired

I am getting this error in [WordPress][1]' phpMyAdmin: #145 - Table './DB_NAME/wp_posts' is marked as crashed and should be repaired When...

general-dev Solved
JO
asked 1 month ago by John Connor
0 votes
1 ans
3 views
Error 1022 - Can't write; duplicate key in table

I'm getting a 1022 error regarding duplicate keys on create table command. Having looked at the query, I can't understand where the duplication is takin...

general-dev Solved
GI
asked 1 month ago by Git-able
0 votes
1 ans
3 views
setting multiple column using one update

How to set multiple columns of a table using update query in mysql?

general-dev Solved
AM
asked 1 month ago by Amogh
0 votes
1 ans
3 views
Configuration System Failed to Initialize

I'm currently creating a Login form and have this code: string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"...

general-dev Solved
SE
asked 1 month ago by sean