Skip to main content
Tweeted twitter.com/StackDBAs/status/1005451208667140096
fix format, trim noise
Source Link
Erwin Brandstetter
  • 182.2k
  • 28
  • 457
  • 620

Hello Stack Overflow Exchange People

Is there a straightforward way to adapt these types of mySQLMySQL queries to postgreSQLPostgreSQL:

  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)

Thanks.

Hello Stack Overflow Exchange People

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 (2)

Thanks

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).

Fixed your formatting, please read the formatting guidance
Source Link
Craig Ringer
  • 57.3k
  • 6
  • 159
  • 192

PostgreSQL equivalent of mysql constructMySQL query variables?

Hello Stack Overflow Exchange People

Is there a straightforward way to adapt these types of mySQL queries to postgreSQL:

a) setting variables in MySQL like

set @aintconst = -333

set @arealconst = -9.999

  1. setting variables in MySQL like

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

It seems not: https://stackoverflow.com/questions/13316773/is-there-a-way-to-define-a-named-constant-in-a-postgresql-queryIt seems not

b) 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

  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 b(2)

Thanks

PostgreSQL equivalent of mysql construct

Hello Stack Overflow Exchange People

Is there a straightforward way to adapt these types of mySQL queries to postgreSQL:

a) setting variables in MySQL like

set @aintconst = -333

set @arealconst = -9.999

It seems not: https://stackoverflow.com/questions/13316773/is-there-a-way-to-define-a-named-constant-in-a-postgresql-query

b) 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 b)

Thanks

PostgreSQL equivalent of MySQL query variables?

Hello Stack Overflow Exchange People

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 (2)

Thanks

This ain't no Stack Overflow!
Source Link
Hannah Vernon
  • 70.5k
  • 22
  • 177
  • 321

Hello Stack OverflowOverflow Exchange People

Is there a straightforward way to adapt these types of mySQL queries to postgreSQL:

a) setting variables in MySQL like

set @aintconst = -333

set @arealconst = -9.999

It seems not: https://stackoverflow.com/questions/13316773/is-there-a-way-to-define-a-named-constant-in-a-postgresql-query

b) 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 b)

Thanks

Hello Stack Overflow People

Is there a straightforward way to adapt these types of mySQL queries to postgreSQL:

a) setting variables in MySQL like

set @aintconst = -333

set @arealconst = -9.999

It seems not: https://stackoverflow.com/questions/13316773/is-there-a-way-to-define-a-named-constant-in-a-postgresql-query

b) 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 b)

Thanks

Hello Stack Overflow Exchange People

Is there a straightforward way to adapt these types of mySQL queries to postgreSQL:

a) setting variables in MySQL like

set @aintconst = -333

set @arealconst = -9.999

It seems not: https://stackoverflow.com/questions/13316773/is-there-a-way-to-define-a-named-constant-in-a-postgresql-query

b) 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 b)

Thanks

Source Link
Daniel
  • 243
  • 1
  • 2
  • 6
Loading