Search
 
SCRIPT & CODE EXAMPLE
 

SQL

get rows from 1 table with other table empty mysql

SELECT students.name, students.lastname, ifnull(courses.course_name, '-') as course_name
FROM students
LEFT JOIN courses
ON courses.id_student=students.id_student 
WHERE students.name LIKE '%$search%'
GROUP BY students.id_student 
ORDER BY students.name, students.lastname, courses.course_name
Comment

PREVIOUS NEXT
Code Example
Sql :: comma seperated join mssql 
Sql :: sql group by and having 
Sql :: case when with count and combining similar values in sql 
Sql :: sql promises req, res 
Sql :: How to select only the first rows for each unique value of a sql tablecolumn? 
Sql :: To Create directory 
Sql :: report in database 
Sql :: Extend the 2.1 case study to implement below listed queries. Write separate operations/method to implement each query. a.Query all books in database. 
Sql :: MySQL can’t specify target table for update in FROM clause (Updating same table from same select inner join table) 
Sql :: oracle sql add column auto generated value 
Sql :: mysql join table with a text columns with ids splited by char 
Sql :: sql script to get a type task on jira datbase for 12 months 
Sql :: nodejs sql get one to many relationship as array 
Sql :: t-sql conditional order by multiple columns 
Sql :: to_sql id colymn 
Sql :: titlecase in sql 
Sql :: mysql export search results 
Sql :: show database size or specific database table size 
Sql :: how to create a table from another table in sql derby 
Sql :: which is the order of precedence among following operator IN OUT AND OR in sql 
Sql :: quantity count and group by some article 
Sql :: sql grant select only 
Sql :: salesforce cpq apply immediately 
Sql :: power bi connect to postgresql 
Sql :: clickhouse greatest non-aggregate 
Sql :: the primary key is selected from the 
Sql :: add new column in table 
Sql :: sql compiler 
Sql :: how to open database 
Sql :: where sqlalchemy 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =