SQL Query error

  


Hi, 

I am new to OutSystem and i am trying to execute below mentioned query using SQL Task.  i am geeting a warning message but i am not able to get the desired output.  The same query works in SQL Server TSQL.  but when i run on Outsystems SQL Task it is not executing.  Please help me by providing a suitable solution.

Thanks in advance.


SELECT
    {Booking}.[CheckinDate], ((count(1)/100) * (select count(1) from {Room} , '', '', ''
FROM
    {Booking} WHERE
    {Booking}.[CheckinDate] >= getdate() - 7
 GROUP BY
   {Booking}.[CheckinDate]
ORDER BY
    {Booking}.[CheckinDate]


Hi,

From a quick glance, you're missing two closing parentheses. Try this command:

SELECT
    {Booking}.[CheckinDate], ((count(1)/100) * (select count(1) from {Room})) , '', '', ''
FROM
    {Booking} WHERE
    {Booking}.[CheckinDate] >= getdate() - 7
 GROUP BY
   {Booking}.[CheckinDate]
ORDER BY
    {Booking}.[CheckinDate]

Aurelio Santos wrote:

Thank you very much for correcting my query.  if i execute output is showing as 0

i resolved this issue in different way. 


SyntaxEditor Code Snippet
SELECT count(distinct {Room}.[Id]) from {Room}
join {Booking} on {Room}.[Id] = {Booking}.[RoomID]
where ({Booking}.[CheckinDate] < @ItrDate or {Booking}.[CheckinDate] = @ItrDate)
and ({Booking}.[CheckoutDate] > @ItrDate or {Booking}.[CheckoutDate] = @ItrDate)
and {Booking}.[StatusID] != @StatusId


Thanks again for you valuable feedback