Code: Select all
SELECT id, name, count as (SELECT count(*) from tableB where id = '5') from table
where id = '5'
Moderator: General Moderators
Code: Select all
SELECT id, name, count as (SELECT count(*) from tableB where id = '5') from table
where id = '5'
Code: Select all
SELECT id, (SELECT count(*) FROM config) AS test FROM users;Almost. The As means the name you want it to be called, so:GeXus wrote:Is it possible to do something like this...Code: Select all
SELECT id, name, count as (SELECT count(*) from tableB where id = '5') from table where id = '5'
Code: Select all
SELECT id, name, (SELECT COUNT(*) FROM tableB WHERE id = '5') as mycount
FROM table WHERE id = '5'Code: Select all
SELECT id, name, COUNT(b.id) AS mycount
FROM table AS a, tableB As b
WHERE a.id='5' AND b.id='5'
GROUP BY b.id