0
votes
2answers
13 views

MySql SELECT names from users WHERE name LIKE “$searchTerm” AND status <> 'blocked'

I need to make a Query like this. MySql-> SELECT names from users_tb WHERE names LIKE "$searchTerm" AND status <> 'blocked' So The Query should SELECT all ROWS with names that match the ...
1
vote
1answer
39 views

Tetting a sum for every distinct value in a database

I have a database of Fantasy Football Managers and 15 players on each of their teams. I can do the following to list all the teams with "Robin Van Persie" in it. SELECT * FROM `players` WHERE ...
1
vote
1answer
31 views

Can I use a join query to do this?

I have to admit trying to understand JOINs makes my brain explode so I need some help. What I'm trying to accomplish is return info on the last 25 postings in a forum, but the main posts table only ...
1
vote
3answers
16 views

MYSQL merge in one column if given column has no value

How can I merge two column in ONE column if the given column (year_id) has no value (null) table 1 id txt year_id date ---------------------------------- 1 text1 1 2 text2 ...
0
votes
2answers
20 views

How to return rows that have the same column values in MySql

Lets consider the following table- ID Score 1 95 2 100 3 88 4 100 5 73 I am a total SQL noob but how do I return the Scores featuring both IDs 2 and 4? So it should return 100 since its ...
0
votes
2answers
20 views

merging SQL statements and how can it affect processing time

Let's assume I have the following tables: items table item_id|view_count item_views table view_id|item_id|ip_address|last_view What I would like to do is: If last view of item with given item_id ...
0
votes
2answers
32 views

Division by a second query

I'm trying to first query by the second one, how would I go about this? SELECT COUNT(*) AS Result FROM pparsdb.application INNER JOIN pparsdb.planning_scheme ON application.planning_scheme = ...
0
votes
2answers
44 views

MySQL select query

I have 3 tables t1, t2 and t3. Below are their schemas. I need to join them and do have the condition. In t1 table, objectName can be one of 4: 'ABC', 'DEF', 'GHI', or 'JKL'. If t1.objectName is ...
-1
votes
1answer
17 views

MySQL, get a sum from column after grouped by another column

I have a DB table votes that looks like | id | val | against_id | created_at | ----------------------------------------------------- A | 1 | B | xxx B ...
0
votes
1answer
19 views

sql error SyntaxException preparedstatement

I am using a PreparedStatement to execute a SQL query. Here is the Query. select * from DEVICES WHERE device_id in (?,?,?,?) Here is the error i am getting ...
0
votes
1answer
30 views

Count(1) and the Like statement Best use/Performance

Is there a better way of doing the below sql query I am not sure if the Like statement is the best option as the location column only contains exact matches. INSERT INTO test_reports (Table_Name, ...
0
votes
1answer
30 views

SQL update id all table

I have table row idenntifyID type varchar, I want set values ID 01, ID 02, ID 03 it's possible with only SQL ? now is ID 200, ID 654 etc, I want change that will be from 1 to n
0
votes
2answers
16 views

How to create a dummy value column in MySQL depending on the Table specific information was selected from?

I have two tables that contain information about users. One table, current_users keeps track of current users and the other table, new_users, contains data of users who have recently submitted their ...
0
votes
1answer
17 views

INSERT INTO COUNT(*) updating timestamp automatically in MYSQL

How can i run the below query with the following table structure under test_reports Table_Name Date (Current TimeStamp) Total_Count INSERT INTO test_reports SELECT "table1", "date", COUNT(*) from ...
3
votes
2answers
20 views

MySql. How to use Self Join

I need to use Self Join on this table. +------------+------+--------+ | Country | Rank | Year | +------------+------+--------+ |France | 55 | 2000 | +------------+------+--------+ ...

1 2 3 4 5 1961
15 30 50 per page