Hi guys,
Suppose I have a table like this:
hseid | projcode | bulidarea | room | hall | floor | totalfloor | price
0 | 1 | 100 | 1 | 1 | 9 | 25 | 100
1 | 2 | 99 | 1 | 1 | 9 | 25 | 100
2 | 2 | 101 | 1 | 1 | 9 | 25 | 100
3 | 4 | 110 | 1 | 1 | 9 | 25 | 100
4 | 3 | 130 | 1 | 1 | 9 | 25 | 100
5 | 1 | 95 | 1 | 1 | 9 | 25 | 100
6 | 4...
I am writing my own PDO wrapper to make my life easier and a fair amount safer.
A standard query looks like:
$user = $db->select('users')
->eq('twitter_id', $twitter_id)
->limit(1)
->prepare()
->exec();
Generates this query:
SELECT * FROM users WHERE twitter_id = :twitter_id LIMIT 1
This...
I am very new to PHP/programming, with that in mind I am trying to come up with a function that I can pass all my strings through to sanatize. So that the string that comes out of it will be safe for database insertion. But there are so many filtering functions out there I am not sure which ones I should use/need. Please help me fill in ...
My two main requirements for the site are related to degrees of separation and graph matching (given two graphs, return some kind of similarity score).
My first thought was to use MySql to do it, which would probably work out okay for storing how I want to manage 'friends' (similar to Twitter), but I'm thinking if I want to show users r...
I just erased and re-installed Snow Leopard. I installed MySQL 5.1.48 64-bit clean. I'm having issues with the MySQL server... when I boot the computer and log in, the server is not running. I tried to start it using the preference pane by clicking "Start MySQL Server", but all it did was highlight the button blue and think for like a mi...
I have a table with a VARBINARY column. I need to insert a string such as '4D2AFF' which represents the hex values 0x4D, 0x2A and 0xFF respectively. How do I construct this statement?
...
Hello.
I've tried in 1 hour now, trying to find out how I could extract something from the database, in a INNER JOIN with a simple SQL syntax.
It works, nearly and my question is how can i select more than only one row from the table.
My SQL syntax:
SELECT topics.topic_id, topics.topic_subject, COUNT(posts.post_topic) AS comments
FRO...
Hi all!
I need some help optimizing queries on 2 tables. One will contain about a million and the other will contain about 10 million of rows.
here is the table structure --
Table Structure
Sample Browse and Search Queries
These queries takes a very long time, about 15-20 secs, in some cases over a minute
So, please have a look an...
I'm currently using mysql w/ PHP because that's what I learned and haven't ever had to use anything else. In my current project, I have a database w/ 10 million rows and about 10 columns and have found it to be very slow when I do complex calls, both in a local (windows) environment as well as production (linux) environment. Both servers...
In a map application i display markers on a map based on the visible map area using a query similar to the following.
SELECT * FROM (`properties`)
WHERE `lat` > '-11.824448' AND `lat` < '84.124002' AND
`lng` > '-152.243398' AND `lng` < '-39.743398'
LIMIT 20;
Due to the index on the table this results in results appearing us...
What would be the correct syntax and join (if any) of a subquery that would return all of the employees first and last name from the employee’s table, and return their department name from the department table, but only those employees who more than the average salary for their department?
Thanks for your answers
...
I have created a button specific for submitting appeals for punishments.
Here is the page: oldserver.net/button/lookup.php?id=80
It doesn't work like it should... I included test.php inside the main file at lookup.php and it doesn't work at all. Search queries work just fine. It's javascript that is not working right. So I don't kno...
I have a String field in the DB (mySQL) and on click of a button on a JSP page I want to download the contents of that field to a file on the client machine.
The client can give a name or a default name I should be able to give.
My server is tomcat.
...
Is there any way I can get the actual row number from a query?
I want to be able to order a table called league_girl by a field called score; and return the username and the actual row position of that username.
I'm wanting to rank the users so i can tell where a particular user is, ie. Joe is position 100 out of 200.
Ie.
User Score ...
Hi,
I am trying to make a query to get the post title, link and images of the post. I have what I need with the following query:
SELECT WPPOSTS.post_title,WPPOSTS.guid,WPPOSTS_2.image
FROM wp_posts WPPOSTS
LEFT JOIN
(
SELECT guid AS image,post_parent
FROM wp_posts
WHERE post_type = 'attachment'
ORDER BY post_date_gmt DESC
) WPPOSTS_2...
I have a table say something like this:
column_a column_b
foo 1
bar 1
baz 2
I need to get this in my result set:
foo 1
baz 2
Thus, I need to select rows where the field column_b is distinct. I tried coming up with ways to do this by using a subquery with select distinct but no dice. I'm still ...
I'm trying to stop members from adding them selves as a friend but I can't seem to get it to work the last line of code in my MySQL query AND '$user_id' <> '$friend_id'
is trying to check if the user id is the same as the friend id and if so stop running the query but for some reason the code will still run.
How do I fix this so the qu...
This was my original question:
“What would be the correct syntax and join (if any) of a subquery that would return all of the employees first and last name from the employee’s table, and return their department name from the department table, but only those employees who more than the average salary for their department? Thanks for your...
Hi all,
Although I understand that it is very convinient to have an index on a unique column - to easily and efficiently check for value collision, I think it should be up to the programmer to specify whether a unique field column is to have an index or not, with regards to size- vs speed- optimization.
As far as I understand MySQL aut...
In rails migration, if I set text column limit to 16777215, and migrate, mysql creates column of type LONGTEXT, but it should create MEDIUMTEXT, as it can store 16Mb - 1 byte, what is wrong (log says that create table column is sent with type text(16777215), so it is something wrong with mysql)? Also spending some time gave me, that maxi...