Questions tagged [mysql-select-db]

74 questions
1
vote
2 answers

MySQL query with group contact

Let's say I have a table called "test" with the following design: SELECT type, name, `key` FROM test type | name | key ------------------------ 0 | maria | 123 1 | gabriel | 455 0 | rihanna | 69 1 | chris | 7 1 | martin |…
user1161005
1
vote
2 answers

how i can put (dash or underscore) between words in (select php,mysql)?

i have selected some rows from mysql and i want put underscore between the words like this :
1
vote
2 answers

Mysql select query group concat

I have a select query to build and I can't get it work propery. I was hopeing for a few sudggestions from more advanced MySQL developers. So my tables are: CREATE TABLE IF NOT EXISTS `gv` ( `id` int(11) NOT NULL AUTO_INCREMENT, `option_id`…
0
votes
2 answers

Unable to select database(remote)

every time I try to connect to database, I get this message database select error .Access denied for user ''@'localhost' to database '' . My site is hosted remotely . To connect to database , my connect.php is like : $host =…
Nitish
  • 2,695
  • 9
  • 53
  • 88
0
votes
0 answers

Mysql service stuck sometime not able to login to mysql after reboot the server

I am using a mysql server but sometimes i face a problem that not able to login to mysql server just after reboot the server Its not happen every time but there is 2-3 case in 20 cases that mysql not able to login Got a error 2002 is this okey or…
0
votes
3 answers

PHP mysql_db_query being deprecated. Can't fix it

I'm getting the following error while connecting to my SQL database: function mysql_query($query) { $dbhost = "localhost"; $dbuser = "p39438_***"; $dbpass = "password"; $dbname = "p31417_***"; $conn = mysql_connect($dbhost, $dbuser,…
Daan Verberne
  • 45
  • 1
  • 8
0
votes
0 answers

How can I sort and map my SQL query in Ionic?

I have a database running in the background, the aim of the whole thing should be that I have categories as buttons and that categories should be created under elements. I separated the whole thing in the database (i.e. in two tables), i.e. in…
0
votes
4 answers

How do i select all columns, plus the result of the sum

I have this select: "Select * from table" that return: Id Value 1 1 1 1 2 10 2 10 My goal is create a sum from each Value group by id like this: Id Value Sum 1 1 2 1 1 2 2 10 20 2 10 20 I Have tried ways…
0
votes
0 answers

SQL Query for all chat conversations for userID with all names and profiles images

I am building an in app Chat, I've figured out the DB tables on how to store the chat messages, having only private chat. Now I am trying to come up with a good SQL Query for showing all conversations for user with a certain ID alongside with user's…
kalafun
  • 3,512
  • 6
  • 35
  • 49
0
votes
0 answers

How to define an efficient lookup table?

I want to create a table that will act as a lookup table for an application. The format I have in mind is something like: CREATE TABLE Associations ( obj_id int unsigned NOT NULL, attr_id int unsigned NOT NULL, assignment Double NOT NULL …
Jim
  • 3,845
  • 3
  • 22
  • 47
0
votes
2 answers

Select only unique ids row of table with different values in Descending order

I'm trying to get data that have the same medicine_id and unique insurance_id and last inserted row. Put Group by and Order by but in that got random data not last inserted. I tried this code but got not last inserted data SELECT `m1`.`*` FROM …
Nikunj
  • 23
  • 5
0
votes
3 answers

MYSQL Difference between ( field1, field2 ) = (x,y) vs field1= x AND field2 = Y

I have a table studentDB with below fields select sid, sname, sDOB from Student I have seen this is many place, what is difference between (xx,yy) vs AND, and which one is more performance wise better select * from Student where (sid,sname) =…
0
votes
1 answer

How to select everything from one table and a row from another table in SQL

I want to select everything from the table PRODUCT_INFORMATION. I tried to use p.* and PRODUCT_INFORMATION.* but it's not working? Where is my mistake? Is it something with JOIN? SELECT p.PRODUCT_NAME , SUM (oi.QUANTITY) TOTAL_QUANTITY,…
Jellyfish
  • 25
  • 5
0
votes
1 answer

Laravel SQL SELECT 100% CPU

following problem with SELECTS like this only in staging system: SELECT * FROM `nd` WHERE `nd`.`nd_id` IN (1, 396, 782, 830, 831, 1929, 3786, 5059, 5713, 5714, 6698) AND `nd`.`nd_type` = 'App\Models\N' AND `nd`.`deleted_at` IS NULL In my dev…
pette87
  • 1
  • 1
0
votes
0 answers

I get a NULL value from var_dump when assigning a variable to an array in my select query

I have written a SELECT Query to concatenate a person's name and email address. I then want to echo this string. Here is the code: $sqldiv = "Select concat(p1.display_name, " - ", p1.user_email) AS Contact FROM wp_players p1 JOIN wp_divisions2…
BigUncleE
  • 51
  • 8