I have a website that is powered by ASP.NET / Visual Basic and Microsoft SQL.
There are two problems that need solving. Both problems involve complicated SQL queries.
This is URGENT and must be completed today.
### TASK 1 ###
Results are not grouped correctly.
For example, a building may have 20 "One Bedroom" units and 10 "Two Bedroom" units.
There are 30 total units but only 2 types. Only the two types should be displayed on my webpage like this:
---------------------------------------------
Unit Type: One Bedroom
Rent: $100 - $200
Size: 500 Square Feet up to 900 Square Feet
Availability: Yes
---------------------------------------------
Unit Type: Two Bedroom
Rent: $200 - $300
Size: 700 Square Feet up to 950 Square Feet
Availability: No
---------------------------------------------
However because the SQL query is not grouped correctly, I get 30 results instead of 2.
### TASK 2 ###
There are two queries and neither of them are correct.
The first one is for the "COMMERCIAL PROPERTY DEVELOPMENTS" section:
Dim sql As String = "select distinct [login to view URL], Name, Description,
Address from ipm_project p join ipm_project_field_value fp on
[login to view URL] = [login to view URL] and fp.Item_value = '1' join
ipm_project_discipline d on [login to view URL] = [login to view URL] and [login to view URL] =
(Select KeyID from ipm_discipline where KeyName = 'Commercial
Projects' ) Where [login to view URL] = 'y'"
The second one is for the "RESIDENTIAL PROPERTY DEVELOPMENTS" section.
Dim sql2 As String = "select [login to view URL], Name, Description from
ipm_project p join ipm_project_field_value pl on [login to view URL] =
[login to view URL] and pl.Item_ID = (select Item_ID from
ipm_project_field_desc where Item_Tag = 'tag_PROPLOCATION') and
pl.Item_Value like '%Property Development Page%' Where Available = 'Y'
Order By newid() "
---------------
The problem with the first query is that it shows all available
'Commercial Projects' however it should ONLY show available
'Commercial Projects' if the "Item_Tag" named "tag_PROPLOCATION" is
like '%Property Development Page%'
The problem with the second query is that it shows all available
projects where the "Item_Tag" named "tag_PROPLOCATION" is like
'%Property Development Page%' however it should only show them if they
are 'Residential For Rent'
---------------------------------------
I will provide screenshots and links upon requests. I will answer any quesitons about the requirments that you may have.