eWish 971
Recognized Expert Contributor
I am not sure that I am taking the proper approach or even have the best design for what I am doing.
I have a table that I am storing attributes the for a real estate property listing. Each property could have one or several (many to many) attributes. Then I am storing the non-redundant data in the listing table. Instead of using two queries to get the listing and attribute data I would like to be able to do it in one without having duplicate data. I have tried a UNION but the SELECT statements have a different number of columns. -
SELECT listing.mlsID AS 'MLS Number',
-
listing.propertyAddress AS 'Property Address',
-
listing.description AS 'Property Description',
-
listing.city AS 'City',
-
listing.county AS 'County',
-
listing.state AS 'State',
-
listing.zipcode AS 'Zipcode',
-
listing.listPrice AS 'List Price',
-
IFNULL(listing.heatedFT, 'N/A') AS 'Heated SqFt.',
-
IFNULL(listing.totalFT, 'N/A') AS 'Total SqFt.',
-
IFNULL(listing.acres, 'N/A') AS 'Acres',
-
IFNULL(listing.lotSize, 'N/A') AS 'Lot Size',
-
IFNULL(listing.lotDescription, 'N/A') AS 'Lot Description',
-
IFNULL(listing.lotDimensions, 'N/A') AS 'Lot Dimensions',
-
IFNULL(listing.yearBuilt, 'N/A') AS 'Year Built',
-
listing.imageDIR AS 'Image Directory',
-
IFNULL(listing.directions, 'N/A') AS 'Directions',
-
IFNULL(listing.virtualTourUrl, 'N/A') AS 'Virtual Tour URL'
-
FROM re_listings AS listing
-
WHERE listing.mlsID = 555
-
ORDER BY listing.mlsID, listing.city ASC
- SELECT category.name AS 'Category Name',
-
attribute.name AS 'Attribute Name'
-
FROM re_attributeCategory AS category
-
INNER JOIN re_attribute AS attribute ON attribute.categoryID = category.id
-
INNER JOIN re_attributeID AS id ON id.attributeID = attribute.id
-
WHERE id.mlsID = 555
-
ORDER BY category.name ASC
Any suggestions would be appreciated.
0 1375 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Matt O'Donnell |
last post by:
Does anyone know how I can 'join' the results of
one SQL query to the bottom of another?
Eg. I have two queries:
1. SELECT Name, Surname FROM People WHERE Surname = Smith
NAME ...
|
by: Job Lot |
last post by:
Is there anyway of Joining two or more DataTable with similar structure?
I have three DataTables with following structures
Data, AmountB/F, Repayments, InterestCharged and AmountC/F
i want...
|
by: Gianfranco |
last post by:
Hi
I got a problem with 2 tables.
I have a table, say A, with x records, coming from a make table query
and a table, say B, with y records, coming from another make table
query. I need to join...
|
by: Norma |
last post by:
I have 2 queries that pull attendance records depending on the type of
attendance occurance, or Both queries are
drawn off 1 table where the field will depict
whether it is a punctuality or...
|
by: dkintheuk |
last post by:
Hi all,
I'm trying to output a result set from some data as follows:
I have raw data with the following columns
Date,
Country,
System,
ID,
| |
by: Captain Nemo |
last post by:
Hi
I'm working on an ASP project where the clients want to be able to
effectively perform SELECT queries joining tables from two different
databases (located on the same SQL-Server).
Does...
|
by: veaux |
last post by:
Question about joins in queries. I have 2 tables with a field called
"ID".
Table 1
Rec1 = Jan12FredFlintstone
Rec2 = Feb01WilmaRubble
Table 2
Rec1 = Jan12BarneyRubble
Rec2 = Mar03SamSlate
|
by: jason.teen |
last post by:
Hi,
when i am joining on a Column of Text Type with one of Memo type
the resulting entry has funny chinese characters!
Has anyone else encountered this before?
Is there a cure??
Cheers.
|
by: nickvans |
last post by:
Hello everyone,
I am new to SQL Server, and am having trouble joining several SELECT statements together.
I have three SQL Select statements that do separate count operations to get the status...
|
by: bhavinnaik |
last post by:
Hi I am new to the IT enviro...although i've used QSL query for a while now but on simple or single queries.
Here is the problem...
I've got two queries looking at a set of tables to extract the...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |