Skip to main content
4 of 4
fix format, trim noise
Erwin Brandstetter
  • 182.2k
  • 28
  • 457
  • 620

PostgreSQL equivalent of MySQL query variables?

Is there a straightforward way to adapt these types of MySQL queries to PostgreSQL:

  1. setting variables in MySQL like

     set @aintconst = -333
     set @arealconst = -9.999
    

It seems not.

  1. Assigning variables from SELECT queries and using those variables subsequently in my SQL like:

      select @pfID := id from platform where bios like '%INTEL%'
      select @clientID := id from client where platformID = @pfID
    

I'd be very grateful for pointers, especially on (2).

Daniel
  • 243
  • 1
  • 2
  • 6