I am trying to count the number of rows whose date has not yet passed so i can get only the current records
I get an error sayng
MySQL error #111 Invalid use of group function
SELECT COUNT(festivalid) FROM festivals WHERE min(datefrom) > now()
...
Say I have a 'user_log' table with the following field:
id
user_id
status_text
timestamp
How do I write a query that selects only the last update for all the users in that table?
Appreciate your help :)
...
I'm trying to check if the username is available and display it for the user to see when they check there account settings, which I have done.
BUT when the user tries to fill out another field I get the Your username is unavailable! which should not pop up because its the users username already. I want to know how can I fix this proble...
I am trying to create a MySQL Trigger to disable someone's account if they have logged in to the site 3 times. I have tried to create this trigger using the following code, but it is not setting is_active to 0 no matter what times_logged_in is. Any help would be appreciated.
CREATE TRIGGER updateTrigger AFTER UPDATE ON users
FOR EACH ...
I am building a note taking app for myself with tag filtering functions, but am having an issue when trying to grab notes with the tags. The tag filter needs to use AND not IN, because it will help better narrow down what I am looking for.
My tables are configured like this:
+ notes note_id | note_title | note_uid
+ tags...
I have an odd problem where Hibernate is running more queries than I've asked for, and can't see the need for.
Here is my controller:
@Autowired UserService users;
@RequestMapping("/test")
@ResponseBody
public String test() {
User user = users.findUser(1L);
return "Found user: "+user.getEmail();
}
Here is the UserService:
@...
Hi there ,
in order to make things easier for users i want to add multiple keyword search to my site.
so that in the input the user would do something like : " keyword1 keyword 2" ( similar to google for example.
would i need to write a code that would parse that string and do queries based on that or is there something built in mysql th...
I have a table that stores some basic data about visitor sessions on third party web sites. This is its structure:
id, site_id, unixtime, unixtime_last, ip_address, uid
There are four indexes: id, site_id/unixtime, site_id/ip_address, and site_id/uid
There are many different types of ways that we query this table, and all of them are...
I am trying to match a user inputted search term against two tables: posts and galleries. The problem is the union all clause isn't working. Is there something wrong with my code?
$query = mysql_query("
SELECT * FROM posts WHERE title LIKE '%$searchTerm%'
OR author LIKE '%$searchTerm%'
OR location LIKE '%$searchTerm...
Let's say I have a table containing following data:
| id | t0 | t1 | t2 |
______________________
| 1 | 4 | 5 | 6 |
| 2 | 3 | 5 | 2 |
| 3 | 6 | 4 | 5 |
| 4 | 4 | 5 | 9 |
| 5 | 14 | 5 | 49 |
I want to retrieve all the rows containing 4, 5, 6 (regardless the position of numbers in the tables), so row 1 & row 3 will be s...
Hi folks,
My apologies for asking such a novice question but, I need help building a script using either PHP or directly in MySQL that can do the following:
Take the values of a column in a table (text)
Change them into capitalized words (from "this is a title" to "This Is A Title")
Replace the old values (uncapitalized) with the new ...
There is no limitation on the depth.
How to get the structed branch or even entire tree?
The definition is from here:
http://dev.mysql.com/tech-resources/articles/hierarchical-data.html
...
If I select a db db1 with mysql_select_db() is it possible to access another db db2 in a query? I am looking for something like SELECT * FROMdb2.sometableWHERE 1
...
I am stuck on how to create tags for each post on my site. I am not sure how to add the tags into database.
Currently...
I have 3 tables:
+---------------------+ +--------------------+ +---------------------+
| Tags | | Posting | | PostingTags |
+---------------------+ +------------------...
Hi guys.
I've accidentally dropped a database inside my server .
I have no backup of it and binary logs are not enabled (shame on me!) ...
Is there any way to restore that db?
...
Is it possible to open a curl like object in MySQL?
What I would like to do is create procedure which would check to see if a certain value is returned from a specific URL like http://example.com/inschedule?id=200&time=20m. The returned result would be a simple string like 1 or 0.
I know it is better to have a script do this by pu...
I am in a group of people who are creating a Defect Tracking program as a project. We have been using Active Objects and have run into some issues. Currently maximum file size for the blob is approx. 2Mb but we want to be able to increase it up to 2Gb. We currently have been looking at many sites and have not been able to find out how...
To prevent SQL injection, is it necessary to use mysql_real_escape_string(), when magic_quotes_gpc is on?
...
Table structure goes something like this:
Table: Purchasers Columns: id | organization | city | state
Table: Events Columns: id | purchaser_id
My query:
SELECT purchasers.*, events.id AS event_id
FROM purchasers
INNER JOIN events ON events.purchaser_id = purchasers.id
WHERE purchasers.id = '$id'
What I would like to do, is obvio...
Hi all, I'm using GoDaddy's Shared Linux hosting.
Using php i am inserting or updating the mysql database with create date or modified date using the variables
$datestring = "%Y:%m:%d %h:%i:%s";
$time = time();
$createdate= mdate($datestring, $time);
In this $createdate will be the variable i use to insert or update t...