Microsoft
Software
Hardware
Network
Question : null fields
I have a form where people can enter as much info as they wish and then thats inserted into the db. I need to retrieve their last entry. Theres 5 columns and people can complete as few as they wish. How do I write the code to retrieve column 5 but if its null then retrieve column 4. If its null I need column 3. If 3 is null then it would retrieve 2, etc. Thank you so much. This site has helped me tremendously. Thanks to everyone who is helping and has helped.
Answer : null fields
Use COALESCE in your SQL:
SELECT COALESCE(column5,column4,c
olumn3,col
umn2,colum
n1,0) FROM mytable;
COALESCE returns the first value listed that is non-null. Sounds perfect for your situation.
Random Solutions
"microsoft exchange offline address book" creates synchronization error log
unable to scan with my HP Photosmart All-in-one printer
"Another installation in progress..." MSI Installer Issue in Windows Vista
Offline Exchange defrag mismatch in database sizes
Can I install an external fibre channel tape drive onto a traditional non-fibre channel server by adding a fibre channel board in the server?
ephone is registed but does not work
VB script to enble inheritance on folders and files
Exchange 2007 Outlook cannot connect unless HTTP over TCP
use php to create a xml tree and iterate over that tree in jquery
Grant Power User permissions to users in a container