Questions tagged [user-variables]

SQL variables set by the user, without special significance to the RDBMS.

Often referring to SQL server variables, these are variables created by the user, as opposed to system variables presented by the underlying platform.

59 questions
0
votes
1 answer

User variable inside multinested query

I have to optimize a rather long complex query with multiple queries inside. There is a subquery that is repeated many times as a 3rd gen SELECT: (SELECT mc.cotmoneda2 FROM monedacotizaciones mc WHERE date(mc.`FechaHora`)<= date( p.Fechacreacion)…
0
votes
1 answer

MySQL User Defined Variable for every spesific ID

i have create a table and insert some dummy data with this query: CREATE TABLE transaction ( idtransaction INT NOT NULL AUTO_INCREMENT, idproduct INT NOT NULL, quantity INT NOT NULL, PRIMARY KEY (idtransaction)); INSERT INTO…
mosleim
  • 654
  • 6
  • 19
0
votes
2 answers

having trouble with getting rows back from msqli::multi_query

I've got an sql query that contains a number of statements. It: sets a user variable calls a stored procedure calls another stored procedure selects some data I know that the query is correct, because I've tested it in MySQL Workbench, under the…
Carson Myers
  • 37,678
  • 39
  • 126
  • 176
0
votes
1 answer

Any way to run a for loop equivalent in MySQL?

I have a table that basically looks like this: ID Name 1 test1 2 test2 n testn I am trying to write a query that first updates 1 row at a time, then if I am feeling greedy, updates all the rows. I tried…
0
votes
0 answers

User variable in where clause for 'IN'

I'm getting a problem using user-variables in MYSQL. Here's the code I've written. This isn't producing any errors but is not showing the desired results. set @org_id_list := (select c.id from tbl_companyinformations c left join tbl_users u on…
Prathamesh Datar
  • 375
  • 1
  • 4
  • 20
0
votes
1 answer

Define and use a variable with a subquery?

I know normally "the order of evaluation for expressions involving user variables is undefined" so we can't safely define and use a variable in the same select statement. But what if there's a subquery? As an example, I have something like…
JQKP
  • 75
  • 11
0
votes
0 answers

MySQL User Variable Being Overwritten

I have a stored procedure which calls a user function similar to the structure below: CREATE PROCEDURE `MyProc`() BEGIN SELECT MyFunc(Column1), @running := @running + Column2 FROM MyTable JOIN (@running := 0); END CREATE FUNCTION…
fungus1487
  • 1,760
  • 2
  • 20
  • 39
0
votes
0 answers

Setting DATE Variable is SQL

I am not having any luck with using a DATE() variable in the code below - getting Error in Syntax. Have tried SELECT @mydate := DATE(NOW()) as well but same error. Am using MySQL 5.5 SET @mydate = DATE(NOW()) SELECT DISTINCT(rental.id),…
southafricanrob
  • 331
  • 3
  • 15
0
votes
1 answer

Syntax error in local variable inside trigger declaration

I have the following store procedure CREATE PROCEDURE `update_ordenes`() BEGIN DECLARE record CURSOR FOR SELECT ordenes.idorden, ordenes.idafiliado FROM ordenes, afiliados WHERE afiliados.idafiliado =…
Cristhian Boujon
  • 4,060
  • 13
  • 51
  • 90
0
votes
1 answer

MySQL select from view with user variables - Unexpected result

I have 2 tables and a view. In product_oper I have some products that I receive (when id_dest is 1) and that I sell (when id_src is 1). The table product_doc contains the date when the operation took place. CREATE TABLE product_doc ( id…
True Soft
  • 8,675
  • 6
  • 54
  • 83
0
votes
1 answer

Using input form as a variable in api call, php

basically what i'm looking at doing is take a user defined variable, in this case the name of a bird, and then inserting that variable into a url api call. I got how to parse and echo the data once I get it, I just can't seem to find anything on…
0
votes
1 answer

MySQL DELETE statement with an user variable on a where-in clause?

Suppose I have this table: drop table if exists t_user; CREATE TABLE t_user (usr int, grp int); INSERT INTO t_user VALUES (123456, 5); INSERT INTO t_user VALUES (111111, 5); INSERT INTO t_user VALUES (111311, 5); INSERT INTO t_user VALUES (122111,…
0
votes
1 answer

how does system variables and user variables work

i configured maven home in uservaribles and tested it using the command mvn --version ,system proment me as "mvn is not a command" . But if i configure it to System variables its working. i did configuring to system variables in my laptop. But at my…
developer
  • 9,116
  • 29
  • 91
  • 150
-1
votes
0 answers

Command line closed instantly after typing "Flutter ___"

I face this problem after I reset my android studio. I re install the android studio and re install the flutter latest version 3.12.3 stable. I follow the steps mention by stack overflow users. I change the path of SDK to all the drive. I update my…
1 2 3
4