Model::insert([
[row1], [row2], [row3], [row4],
]);
select
users.id, users.name, group_concat(country.country) as visited
from
users
left join user_to_country on user_to_country.user_id = users.id
left join country on user_to_country.country_id = country.id
where u_status = 1
group by users.id, users.name;
Standard SQL disallows references to column aliases in a WHERE clause. This restriction is imposed because when the WHERE clause is evaluated, the column value may not yet have been determined.
select table0.user_id, table1.value_1, table2.value_2
from (select user_id from table group by user_id) as table0
left join table as table1 on table0.user_id = table1.user_id AND table1.type = 'remove' and table1.action_type = 3
left join table as table2 on table0.user_id = table2.user_id AND table2.type = 'give' and table2.action_type = 22
select * from users join (select userid, count(*) as count from fileshare group by userid) as t on users.id = t.userid order by count desc;
select * from users left join (select userid, max(dateupload) as dateupload from fileshare group by userid) as t on users.id = t.userid order by dateupload desc;
`DATE_INSERT` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
select * from news order by (id > ИД_ТЕКУЩЕЙ НОВОСТИ) desc, id limit 5;
SELECT
(SELECT group_concat(idTag) FROM tag_in_record WHERE idRecord = 7060) AS list,
*
FROM records WHERE id = 7060
SELECT
*,
group_concat(idTag) AS list
FROM records
join tag_in_record on tag_in_record.idRecord = records.id
WHERE id = 7060
group by records.fields
$query = 'UPDATE `walets` SET BNB=IFNULL(BNB, "‘.$BNB.’”), BUSD=IFNULL(BUSD, "‘.$BUSD.’”),TRX=IFNULL(TRX, "‘.$TRX.’”), USDT=IFNULL(USDT, "'.$USDT.'")';