Search
 
SCRIPT & CODE EXAMPLE
 

SQL

use cases condition in sql query laravel

->selectRaw("shares.id AS share_id, users.id AS user_id , 
    shares.connected_user_id ,    
      shares.original_language_id, shares.image,
      users.first_name, users.last_name, users.email,
      locations.city, provinces.name, countries.code,
      locations.lat, locations.lng,
      shares.created_at,
      (CASE WHEN users.id = {$user} THEN 1 ELSE 0 END) AS is_user)")
    ->orderBy('shares.created_at', 'desc')
Comment

PREVIOUS NEXT
Code Example
Sql :: import database in phpmyadmin command line 
Sql :: mysql import sql file 
Sql :: how to delay stored procedure execution in sql server 
Sql :: get columns number sql 
Sql :: connect python to mysql 
Sql :: oracle cpu per session 
Sql :: show user mysql 
Sql :: mysql set field unique 
Sql :: oracle next run dates 
Sql :: mysql delete last row 
Sql :: how to convert number to hours and minutes in oracle sql 
Sql :: current setting postgres timezone 
Sql :: SQL select past number of days 
Sql :: create table mysql query 
Sql :: sql command to find foreign key references 
Sql :: sql current_timestamp 
Sql :: dual table in aql 
Sql :: pentaho + pasar de excel a sql 
Sql :: sql query with replace function 
Sql :: mysql show charset 
Sql :: mysql select for update ejemplo 
Sql :: What is the compatibility level of a SQL database 
Sql :: sql server query list all databases 
Sql :: list columns in table postgres 
Sql :: select count from table mysql 
Sql :: oracle sequence last_number 
Sql :: oracle character set 
Sql :: having vs where sql 
Sql :: date to string sql 
Sql :: how to know password of mysql root in linux terminal 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =