Search
 
SCRIPT & CODE EXAMPLE
 

SQL

postgresql variable in query

-- with myVar as (select "any value really")
-- 		then, to get access to the value stored in this construction, you do
-- 			(select * from myVar)
-- for example

with var as (select 123)    
... where id = (select * from var)

-- You could event re-cast the value (e.g. from INT to VARCHAR) 
with var as (select 123)    
... where id = ((select * from var)::VARCHAR)
Comment

PREVIOUS NEXT
Code Example
Sql :: open postgresql.conf in centos 
Sql :: primary key sql 
Sql :: sql if else 
Sql :: insert data from one database table to another database table in postgresql using pgadmin 
Sql :: get month sql 
Sql :: mysql extract day from date leading zero 
Sql :: sql server delete records with specific date 
Sql :: sql create cluster index 
Sql :: how to find first 3 highest salary in sql 
Sql :: sql numeric data type 
Sql :: vi set sql syntax 
Sql :: mysqldump devilbox 
Sql :: get number of rows in every table mysql 
Sql :: ALTER TABLE CHANGE TABE SPACE ORACLE 
Sql :: mysql get 2nd value in comma separated list 
Sql :: how to replace null values in sql 
Sql :: how to join multiple table in mysql 
Sql :: selecting specific day in colum sql 
Sql :: SQL Copy From Two Tables to One 
Sql :: last date for each user sql 
Sql :: oracle synonym procedure 
Sql :: postgresql inheritance 
Sql :: mysql delet from the child table when we delete the rows from the parent 
Sql :: linq inner join 
Sql :: three inner joins sql 
Sql :: convert minutes to hours in sql 
Sql :: connectionString 
Sql :: select into oracle 
Sql :: clustered-nonclustered indexes(constraints) 
Sql :: postgres backup of table 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =