I have a table like this:
id number otherfields
-------------------------------------------
664 48 aaa
665 49 bbb
666 55 ccc
667 48 ddd
My query groups by the number field, and I want it to pick the first (lowest) id, so that the data comes out like ccc,aaa,bbb (when ordered by numb...
How can I grab the count value from the query MySQL query below using PHP.
Here is My MySQL code.
$dbc = mysqli_query($mysqli,"SELECT COUNT(*) FROM((SELECT users_friends.id
FROM users_friends
INNER JOIN users ON users_friends.user_id = users.user_id
WHE...
How can I get just the table comment from a mysql table? I tried the following, but they didn't work for various reasons. I want to figure out how to get just the string 'my comment' (ideally via perl =)
Any help?
-- Abbreviated output for convenience.
SHOW TABLE STATUS WHERE Name="foo"
+------+--------+---------+------------+------+...
Hello all,
i have one form which need to submit data into two different tables in same DB.
at past time, i have asked how to submit form into two tables, but it impossible.
Then, I try to submit this form use two submit buttons with different destination.
Could you give some advise to submit this form after click them?
...
Hi,
I am storing images data as blob data type on MySQL on server. Now I would like to retrieve images from that MySQL database to iPhone. But I don't know how I can do that, can somebody suggest me some solutions?
I can view the images using PHP script on server. But how I send image data to iPhone? In Iphone, I am using NSURLConnecti...
my phpmyadmin showing the table type are myisam ,
but my tables are innodb, Why it is showing as myisam ,
...
I have a table with two fields; firstname & lastname
I want to select Distinct lastnames but display both the first & last name in the results...for instance:
'SELECT DISTINCT lastname FROM people
will return just the lastname. How can I also display the firstname?
...
I have a database relationship that looks something like this:
booking -> person <-> option
-> : one-to-many
<-> : many-to-many
I now need to list all the persons in a booking, with all their options. Using ORM in kohana I can load all persons like this:
$persons = ORM::factory('booking', $id)->persons->find_all();
I could then l...
It's a bit silly asking homework questions here, however I'm genuinely stumped as to what this question is asking.
Create a stored procedure to add
results. The procedure should take
four (4) parameters. These are; The
student's name (first and last), the
name of the apparatus and the score.
When the data has been inserted,...
I'm trying to import a CSV file to a mysql database.
The CSV file contains (amongst other things) dates in the following format:
"2010-04-31 17:43:12"
My first approach was to use the following .sql script:
USE test;
LOAD DATA INFILE '/tmp/test.cvs'
replace INTO TABLE test_table
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(......
Hi Guys,
I was wondering if anybody would have some input on how I could possibly optimize this MySQL query. I think I'm doing the right thing with indexes so don't think I can get this query any faster (it's currently taking more than 3 seconds to run) but would really love somebody with more experience to prove me wrong.
Here's the q...
Hi,
I have lot of excel files to import in mysql table.
Is there any mysql command/procedure which directly takes excel file and import it in table one by one?
or any simpler way to to this task in few steps?
...
1)I have a table employee(emp_id, emp_name,emp_salary);
I want to find top 2 employees having max salary without using limit
2)how do i run a query so that it takes records from databses on two database mysql servers
this should be done in single mysql query
thanks in advance for any help or replies
...
Suppose:
$sql = " SELECT * FROM `artwork` WHERE approved = '1' ";
if($filter) $sql .= " AND $filter = '$filter_value' ";
$sql .= " ORDER BY subdate DESC, id DESC
LIMIT 30,30";
If I were to introduce a starting point (eg. WHERE id > 50) and that stipulation affected my LIMIT su...
Hi, I'm trying to make a application for keeping attendance for a relative's martial arts studio. I've tried looking around for some similar examples, but I couldn't find any specific or clear enough ones for this kind of application.
At the moment, I am using two tables, one for keeping student information, students(id, first_name, la...
I'm trying to implement a live search for my website. One that identifies words, or parts of a word, in a given string. The instant results are then underlined where they match the query.
For example, a query of "Fried green tomatoes" would yield:
SELECT *
FROM articles
WHERE (title LIKE '%fried%' OR
title LIKE '%green%' OR
...
Is there a direct command line command that provides all mysql server information like below...This is provided using Mysql GUI administrator. Do we have some direct command to get this info ussing command line ?
Username:
Hostname:
Port:
Server Information
MySQL Version:
Network Name:
IP:
Client Information
Version:
Network name:
IP:
...
what is the maximum value allowed for tinyint(2) ?
Is the maximum above allowed value 255 or 99 ? I am confused because (2) after tinyint(2) denotes only the display....am I correct ?
...
What I'm trying to do is go from a search URL such as this:
search.php?president=Roosevelt,+F.&congress=&nomination_received_by_senate=&state=CT
To a MySQL query like this:
SELECT `name` FROM `nominations` WHERE president=`Roosevelt, F.` AND state=`CT`
I have some code that strips any empty values from the URL, so I have an array a...
I have a given scenario, the user (my client) wants to give discount for the coming thanks giving season. (or) if you purchase more than $X amount he is eligible for free shipping.
In order to implement the above scenario, what are the changes to mysql database
structure that we need to do ?
How to implement it in a query ?
...