1
vote
1answer
28 views

MAX in SELECT statement

username level me 1 you 1 me 2 me 3 you 1 I want to get the highest value for each username. So it should give me 3 for 'me', and 1 for 'you'. How do I ...
0
votes
1answer
14 views

MySQL/SQLite insert same random # to multiple rows

MySQL/SQLite I want to insert a randomly generated number (of 9 positions) into multiple rows BUT they need to be the same for all rows matched in the query. update products set tag_seed=( SELECT ...
0
votes
2answers
28 views

mySQL giving more results than my query is supposed to

I'm trying to construct a MySQL-query, where the result is based on the given ingredients. If said that I provide Tequila, Orangejuice and Grenadine, I want the result to be Tequila Sunrise ONLY. ...
0
votes
1answer
35 views

How to use join in MySQL

In MySQL, I have two tables. tasks id name checklist id member_id tasks_id In the php page, I create the sql select string, I have a php variable that has a members_id value which is the ...
1
vote
2answers
22 views

Order of assignments in a where clause during a select that makes a join between 2 tables

I got a doubt. Suppose I got this: Invoice (Cod, CodCustomer) Customer (Cod,Name) and i want to select the Customer's name of an X invoice: SELECT Customer.Name FROM Invoice,Customer WHERE ...
1
vote
3answers
44 views

How to fetch a row which is related to multiple rows in another table?

I have some tables: ws_shop_product CREATE TABLE `ws_shop_product` ( `product_id` int(10) unsigned NOT NULL AUTO_INCREMENT `product_title` varchar(255) COLLATE utf8_general_ci DEFAULT ...
1
vote
1answer
27 views

Populate a table with random set of rows from another table on insert using a trigger

I got this problem. I have a mysql database with this tables: USERS(Cod,Interests) SURVEY(Cod,Target_Interests) USERS_OF_A_SURVEY(CodSurvey,CodUser) with Interests having the same set of values of ...
0
votes
1answer
31 views

MySql select IN clause string comma delimited

I need to perform a select query in the following manner: select * from my_table where id NOT IN (comma_delimited_string); What is the correct way to achieve that? Considering the fact that I am ...
0
votes
2answers
31 views

MYSQL - Select statement, if condition fail return empty string

I have this query (MYSQL): SELECT agent.name,agency.title FROM agent, agency WHERE agent.id = "1" AND agent.titleid = agency.titleid This will give me a record with the name and title, ...
0
votes
1answer
27 views

MySQL: Count unique pairs of values in rows

I'm stuck with a problem I don't know how to solve. Here's what my table 'myTable' look like: +----------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key ...
2
votes
3answers
35 views

Mysql Select and Fetch table data starting from specific value

This is an example of my table: |..id.|.class...|.group....|..name....| |..5..|....1....|.....A....|....XX....| |.19..|....1....|.....B....|....XX....| |.12..|....2....|.....A....|....XX....| ...
0
votes
2answers
15 views

sql select to get older than 15 days with multiple where clause

I`m trying to get information out of a database that is more than 15 days old and is in a status used and category nature but for some reason the results seem to come close to what I was expecting but ...
0
votes
1answer
25 views

MYSQL SELECT MAXIMUM RECORD BY USERS ONLY IF USER AS THE HIGEST VALUE FOR THIS ID

I have 1 table that I need to have a query made on it. I am looking to retreive the sum of all the higest value I have place on each veh_id only if I have the highest value for that veh_id. Here is ...
-4
votes
1answer
44 views

Why is this SQL statement not working?

Can somene please tell me why is this SQL statement not executing? The error I am getting is 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for ...
1
vote
3answers
21 views

mysql select order issue

I have a table like that id UserID score create_time 7 002YEXEKF9 120000 2013-06-06 14:04:52 8 0008FV2FN5 120 2013-06-06 15:10:39 9 0008FV2FN5 130 ...

1 2 3 4 5 244
15 30 50 per page