Ask a Question related to ASP Database, Design and Development.
-
Matt Smith #1
SQL Assistance - won't select where field is blank.
I'm selecting fields from my main table (ProductData). Each record in that
table has a SupplierIndex.
There is a field called SubCategory, which looks up from
tblSubCatList.iSubCatID but which is not necessarily populated.
My SQL statement is as follows:
SELECT ProductData.DacNumber, ProductData.ProdName & ' ' &
ProductData.SuppliersCatalogueNumber AS ProdName, ProductData.ProdPrice
FROM tblSubCatList INNER JOIN ProductData ON tblSubCatList.iSubCatID =
ProductData.SubCategory
WHERE (((ProductData.SupplierIndex)=1))
ORDER BY ProductData.SubCategory, ProductData.ProdName;
However, it only selects those records whose field SubCategory is populated.
How can I make it pick up those records that have no subcategory?
Any ideas?
Cheers
Matt
PS. The database is Access 2000 but will be converted to MSSQL once I go
live.
Matt Smith Guest
-
Easy one -- Validating a blank field
Hi, I have three text fields in a form. At least one of the text fields needs to be populated before the form is submitted. This seems... -
Select a list of items into an aliased field when doinga select
OK I know this is going to sound weird, but I'm wondering if this is possible. I have a task table. (tblTask) These tasks can be assigned to... -
Using ASP to Generate SQL Select Statement creates unexpected blank spaces
"Kaven Tan" wrote in message news:F2CAE485-4014-40C7-9A52-1007B51B290E@microsoft.com... : I am having a problem removing the blank space that is... -
Assistance with SELECT BETWEEN
SELECT area, count(*) * 100/ (select count (*) from traffic) as FROM traffic WHERE datein between "10/1/2003" and "11/30/2003" GROUP by area ... -
Detecting Blank form field
Hi there, I' m getting a (0x80040E2F) error, if I submit my form, with blank textboxes to my update stored procedure. The stored procedure expect... -
Aaron Bertrand - MVP #2
Re: SQL Assistance - won't select where field is blank.
Use a LEFT JOIN instead of an INNER JOIN. Is ProductData.SubCategory blank,
or NULL? There is a very big difference.
A
"Matt Smith" <_matt@breathemail.net> wrote in message
news:bemipd$fpm$1@titan.btinternet.com...populated.> I'm selecting fields from my main table (ProductData). Each record in that
> table has a SupplierIndex.
> There is a field called SubCategory, which looks up from
> tblSubCatList.iSubCatID but which is not necessarily populated.
>
> My SQL statement is as follows:
>
> SELECT ProductData.DacNumber, ProductData.ProdName & ' ' &
> ProductData.SuppliersCatalogueNumber AS ProdName, ProductData.ProdPrice
> FROM tblSubCatList INNER JOIN ProductData ON tblSubCatList.iSubCatID =
> ProductData.SubCategory
> WHERE (((ProductData.SupplierIndex)=1))
> ORDER BY ProductData.SubCategory, ProductData.ProdName;
>
> However, it only selects those records whose field SubCategory is> How can I make it pick up those records that have no subcategory?
>
> Any ideas?
>
> Cheers
>
> Matt
>
> PS. The database is Access 2000 but will be converted to MSSQL once I go
> live.
>
>
Aaron Bertrand - MVP Guest
-
Matt Smith #3
Re: SQL Assistance - won't select where field is blank.
"Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message
news:u2W$Tx7RDHA.2676@TK2MSFTNGP10.phx.gbl...I tried sticking a LEFT JOIN in the query but the result is the same. What> Use a LEFT JOIN instead of an INNER JOIN.
>
> A
>
>
is the correct syntax for this?
(maybe slight variation from last time 'cos I've been messing about)
SELECT ProductData.DacNumber, ProductData.ProdName & ' ' &
ProductData.SuppliersCatalogueNumber AS ProdName, ProductData.ProdPrice,
tblSubCatList.strSubCategory FROM tblSubCatList LEFT JOIN ProductData ON
tblSubCatList.iSubCatID = ProductData.SubCategory WHERE
(((ProductData.SupplierIndex)=1))
ORDER BY tblSubCatList.strSubCategory, ProductData.ProdName;
I don't know. If there's no value it's 'cos I haven't entered any data into>Is ProductData.SubCategory blank, or NULL? There is a very big difference.
it, and there's no default value or anything.
Matt
Matt Smith Guest
-
Matt Smith #4
Re: SQL Assistance - won't select where field is blank.
Cracked it. Changed LEFT Join to RIGHT join.
Been doing a bit of reading on the two methods. Don't quite see why it works
yet but give me a minute.
Cheers for your help Aaron. You're a star :)
Matt
Matt Smith Guest
-
Aaron Bertrand - MVP #5
Re: SQL Assistance - won't select where field is blank.
LEFT JOIN includes records from the "left" table (on the left side of the
JOIN clause) that may or may not be in the "right" table. RIGHT JOIN is the
opposite.
"Matt Smith" <_matt@breathemail.net> wrote in message
news:beml9s$be3$1@hercules.btinternet.com...works> Cracked it. Changed LEFT Join to RIGHT join.
>
> Been doing a bit of reading on the two methods. Don't quite see why it> yet but give me a minute.
>
> Cheers for your help Aaron. You're a star :)
>
> Matt
>
>
Aaron Bertrand - MVP Guest



Reply With Quote

