So I'm new to SQL. I have to ensure this file works on both Oracle and SQL Server. For this I use SQL Tools (Oracle) and sQL Server Management Studio.
I'm begining to learn the different between PL/SQL and TSQL (I think), which is basically just to allow them to work together as there are slight differences.
Well, I have this code, and it works for one (SQL Tools), and not for the other. And I dont know why. They both need to work and be the same code.
SELECT DISTINCT * FROM
(
SELECT
somestuff
WHERE mu.id = {my_users_id}
)
WHERE (1=1)
{{parent:ParentUsers:mu_ID}}
Now, I dont know why that doesnt work. It says there is a problem with the WHERE clause. If I comment out the line WHERE mu.id = {my_users_id}
and remove {{parent:ParentUsers:mu_ID}}
then it works in SQL Tools. but not in Management Studio.
Why? And what is going on here?
I thought the point in commenting out code, any code, was so that it doesnt get read, yet I seem to be getting the impression sometimes in some situations they do get read?? Am I wrong here? Thanks
Edit: I realise the lack of code isnt helping, so I've tried to change some things here to represent the real code as much as possible.
SELECT DISTINCT * FROM
(
SELECT
eb2.id AS EB_ID,
ebmystuff_pkg.user_entry_count(EB2.user_code, EB2.address_code, EB2.other_column) ENTRIES,
eb.other_column AS OTHER_COLUMN
FROM MY_TABLE mt
WHERE mu.id = {my_users_id}
)
WHERE (1=1)
{{parent:ParentUsers:mu_ID}}