Tagged Questions
2
votes
1answer
49 views
Count numbers without Zero
I have a query who works correctly, but where I want to make a change.
The query counts all notes for id_service = 89.
The notes are numbers between 0 and 3 not more.
My query counts all those notes ...
0
votes
1answer
20 views
Changing date format globally
I am using PHP and mysql and using either Date or DateTime to save dates in mysql database. On site I have been displaying dates the way they are saved in database.
But now I want to show dates ...
1
vote
3answers
30 views
SQL extra only the day instead of entire date
I have a field in my table called created_date. The date format is 2010-02-28. I just wondering is it possible to do a mysql statement, only return the day instead of the entire date. eg. 28
SELECT
...
1
vote
1answer
49 views
Select column names that match a criteria (MySQL)
I have the following structure in my DB:
id,col_a,col_b,col_c,etc...
Now, all the other columns except for id are of type boolean. Lets say for example that
col_a=1,
col_b=0,
col_c=1
I am ...
1
vote
3answers
61 views
What happens if I select two tables with no WHERE clause?
I had a technical interview last week, and my interviewer asked me what happens if I run the following query:
SELECT * FROM tbl1, tbl2
I think I answered it correctly, but it wasn't an in-depth ...
0
votes
3answers
33 views
how to make a select until find 1 result then exists in mysql
Is there any way to make a select query that search a table for a given word and if it found then exit the query and do not continue counting?
for example I have a table (t1) have the values:
id ...
1
vote
1answer
28 views
Limits on one part of MySQL joins
Currently I'm using the following SQL query to find out what rooms a user is in, and what other users are in those rooms:
SELECT r1.room, r2.user
FROM
rooms r1 JOIN rooms r2 ON r2.room = r1.room ...
1
vote
1answer
51 views
Calculate days between two or three days in one table
I have a table named transaction_detail which contains id_transd, id_trans, id_cust and inputtime.
id_transd | id_trans | id_cust | inputtime |
1 | 1 | 1 | ...
0
votes
1answer
15 views
Convert output of MySQL query to utf8
I have a table in my database and I want run a query like
SELECT column1, column2 FROM my_table WHERE my_condition;
but I want the mysql to return the column2 in utf8 encoding. Is it any function ...
0
votes
3answers
37 views
Is there a way to do this query without the sub-select?
I'm not positive but I believe sub-selects are less than optimal (speedwise?).
Is there a way to remove this sub-select from my query (I think the query is self-explanatory).
select *
from tickers
...
1
vote
1answer
18 views
PHP MYSQL Output Uniform Value to same Table Column
I have a table in my MySQL like the below
============================
id | courses | r_number
----------------------------
1 | English | C/009
2 | Maths | C/009
3 | English | ...
1
vote
1answer
50 views
Is this valid SQL? Or is it breaking any MySQL rules? [closed]
Is this valid SQL? The usage of GROUP BY as well, is it correct?
Also how can I sort the results by TOTAL?
Thanks
SELECT packages.id AS PPIIDD,
Q_ALLOTMENTS.total AS TOTAL,
...
-3
votes
2answers
44 views
PHP SQL Insert …ERROR [closed]
So here's my problem. The only errors that I am getting are the following and I cannot seem to resolve them. Please help!
Code:
mysql_connect("$host", "$username", "$password")or ...
0
votes
1answer
33 views
Displaying values in a column A if column B is the oldest date.
I'm having difficulties in my below table. Table A, is just a part of my present table upon executing my script, there are other columns and rows but i just take out a part of it which i ...
0
votes
1answer
35 views
How can I update filed value from a select with inner join?
I am trying to update a field value in a mysql database using a select query with inner join
I currently get
1064 - You have an error in your SQL syntax; check the manual that corresponds to your ...