APD Toronto
asked on
SQL AND
Hi Experts,
I have the following query
My code is to exclude all records where both fName and lName are blank, but do include if either one contains something, but this query returns:
fldPayerID fldFName fldLName archived
3 Tim Cooper 0
6 A N 1
Where, without my WHERE, I get
fldPayerID fldFName fldLName archived
1 DEPOSIT 0
2 N/A 0
3 Tim Cooper 0
4 paycheque 0
5 Envelope to Tim 0
6 A N 1
In this case, I expect to get all 6 records with and without the WHERE.
What am I doing wrong?
I have the following query
SELECT tblPayers.fldPayerID, tblPayers.fldFName, tblPayers.fldLName, [fldArchived]*(-1) AS archived
FROM tblPayers
WHERE (((tblPayers.fldFName)<>"") AND ((tblPayers.fldLName)<>""))
ORDER BY tblPayers.fldPayerID;
My code is to exclude all records where both fName and lName are blank, but do include if either one contains something, but this query returns:
fldPayerID fldFName fldLName archived
3 Tim Cooper 0
6 A N 1
Where, without my WHERE, I get
fldPayerID fldFName fldLName archived
1 DEPOSIT 0
2 N/A 0
3 Tim Cooper 0
4 paycheque 0
5 Envelope to Tim 0
6 A N 1
In this case, I expect to get all 6 records with and without the WHERE.
What am I doing wrong?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This works, but why & ""<>"" and not <> "" ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
that is to force the null values to a zero length string
ASKER
Aneesh, syntax error.