0
votes
2answers
27 views

Select value if it appears elsewhere in table

I am using mysql and I'm interested in rows where reciprocals appear in a different row in the table. Imagine 2 columns, each with letters a through z. Lets say row1 has a,b, row2 has a,c, and row 3 ...
0
votes
1answer
15 views

NetBeans can SELECT all columns except Primary Key field

This is related to this question, the solution for which did not work for me. I'm using NetBeans to connect to a MySQL database (all running locally, all latest versions, latest JDBC driver). I have ...
0
votes
0answers
60 views

Trying to execute 2 queries at the same time : only one works

I am trying to excute 2 queries once the users likes a post. first query (works fine) : update +1 to table. 2nd query (doesnt work): insert user's id + post's id in new table. See below: ...
0
votes
1answer
12 views

OrderBy a relation in an entity

I've got a headache :) Been trying to google this for an hour, and before that trying to solve it for an hour. I've got an entity A with a ManyToOne relation to another entity B. I need to sort a ...
0
votes
1answer
17 views

how to do inner join on the first row of the table

I have the following query: SELECT p.`id` , p.`name` , pp.`name` FROM `product` p INNER JOIN `product_picture` pp ON p.id = pp.product_id and then this gives me the following result: ...
0
votes
2answers
18 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. ...
2
votes
1answer
16 views

Need to get type value of maximum messageid

I need to get type value of which has maximum value of messageid from table mesaj_mesajlar. I grouped too by type for show you. My query: SELECT mesaj_konular.id AS topicid, mesaj_mesajlar.id ...
0
votes
2answers
22 views

MySQL Show recommended items

I have a news system where users can recommend the item. But now I want that when someone is viewing an item, display a list of other items that have been recommended by people who recommended the ...
0
votes
1answer
26 views

change the format of the date inserted by PHP into MySQL database

I am trying to insert the current date into MySQL database in this format: (12/31/2013 10:26:12 PM). I've tried to make a simple code to change the format, but all I get is a syntax error $sql = ...
1
vote
1answer
28 views

Inner join with like clause

I am using inner join with the like clause .. My tried sql is SELECT tbl_songs.id AS sid, tbl_songs.name AS sname, tbl_albums.id AS aid, tbl_albums.name AS aname FROM ...
0
votes
2answers
9 views

How to build this query with authentic $row['username']?

I've built a page for user permissions and rankings just not to deal with phpmyadmin every time i want to change someones rank or whatever. Now, I have a problem with this query, every time I run all ...
0
votes
2answers
22 views

MySql SUM ALIAS

I have a problem with mysql alias. I have this query: SELECT (`number_of_rooms`) AS total, id_room_type, COUNT( fk_room_type ) AS reservation , SUM(number_of_rooms - reservation) AS ...
0
votes
1answer
23 views

Why does this query work with HAVING but not with WHERE (there is no GROUP BY)

In the following query, I'm using the x and y as coordinates of objects in a two dimensional plane, And am trying to limit the results to only the objects which are within a radius of 80 units from ...
0
votes
5answers
40 views

MySQL - tell if column _all_ has same value

I'm trying to write a query like if (select count(*) from Users where fkId=5000 and status='r') = (select count(*) from Users where fkId=5000) then .. in just one query. What this means is, if ...
0
votes
1answer
36 views

SQL - create a view of multiple tables joined together

I need to create a view of multiple tables joined to a table called artists so that it can be easily referenced. The arrangement of the data in the view is what i am struggling with. I need the ...

1 2 3 4 5 1998
15 30 50 per page