mysql used in the query and if the output of the unit plus

 

 

select (@i: = @ i + 1) i, item_id, name as " program name", intro as "Introduction", CONCAT (episode, "set") as "set number", IF (status = 1, " on-line "," offline ") AS" whether on-line "
from item_info, (SELECT @i: = 0) = AS I WHERE copyright_owner_id. 4 Status Order by desc;

Usage Analysis:

. 1 @i: = @ i + 1 and (selec @i: = 0) to the output and a serial number

2. concat Usage: string concatenation is intended, together with units of the episode where the output field, stitching together outputs + episode is "set"

3. if Usage: to select the field is determined, the output is determined to eradicate: IF (status = 1, "online", "offline")

 

Guess you like

Origin www.cnblogs.com/iifeng/p/11457289.html