I have a query that I can't fully understand. I test it with mysql v.5.5 and getting nothing. here is the snippet:
INSERT INTO
logs (
f1,
f2,
f3,
f4,
f5,
f6
)
SELECT
'test',
'done',
'test',
'test',
'test',
'test'
FROM
logs
WHERE
NOT EXISTS (
SELECT * FROM
logs
WHERE
f1 = 'test' and
f2 = 'done' and
f3 = 'test' and
f4 = 'test' and
f5 = 'test' and
f6 = 'test'
)
LIMIT 1
What I understood is that the fields from other tables can be selected and iserted, but what I don't understand is why not fields, but field values are selected. Was this available in former versions of MySQL ? Also.. I need an appropriate query to be ran in SQL Server 2008. Any explanations? Thanks.