troubleshooting Question

Wild card use in a view...

Avatar of HawaiiDragon
HawaiiDragon asked on
Microsoft SQL ServerMicrosoft SQL Server 2005Microsoft SQL Server 2008
6 Comments1 Solution353 ViewsLast Modified:
Hello experts I am constructing a view and I am having problem in my where statement as I am tryin to use a wildcard in it.

when I dont use my where statements I am getting results but like 15 with ID 1 and 15 with ID 2... its not so much fun so I have a field in table A called Last4onCC and table B called CCLastNum. What i AM TRYING to do is have the a.Last4onCC that has a value of 2367 be matched up with the record from b.CCLastNum value of 47********2367 but its not working as expected... I get Zero results... can someone tell me what I am doing wrong please?

SELECT DISTINCT
                      TOP (100) PERCENT A.id, A.FName, A.LName, A.ParkID, A.Email, A.Address, A.City, A.State, A.Zip, A.PhoneNumber, A.Last4onCC, A.TodaysDate,
                      A.PaymentSucces, B.GUID, B.PaymentType, B.Partial, B.Amount, B.DateEntered, B.IP, B.Successful, B.TransNumber, B.Printed, B.ValidateID, B.Expire,
                       B.PayAmount, B.PaidTime, B.NOVAguid, B.CCLastNum, B.FlowupGUID, A.PaymentType AS Expr1
FROM         dbo.tbl_info AS A INNER JOIN
                      Wdb_CCPayment.dbo.tblPayment AS B ON A.PaymentType = B.PaymentType
WHERE     (A.Last4onCC LIKE B.CCLastNum)
ORDER BY B.PaidTime DESC
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros