Solved

to get In a Query Similar fields in access 2010

Posted on 2011-03-05
5
327 Views
Last Modified: 2012-05-11
i have in a table customert customer with similar names like this

jimmy
jimmy/sample

with other works i have the same name with addition of Backslash and few characters
and i want to make a query that will give me by column one in the query result a customer name and by column 2 to get the similar name with a backslash
please give a sql statement to get this result
0
Comment
Question by:bill201
  • 2
  • 2
5 Comments
 
LVL 75
ID: 35044614
Please show sample data example rows with the *desired* results ....  IE ... Before and After.

mx
0
 

Author Comment

by:bill201
ID: 35044635
very simple

in the database that i have upload iits has a table with the name customert and i want to create a select query (not update)
to see in the first column jimmy and in the second coulumn jimmy/dfdf
etc..

upload59.zip
0
 
LVL 6

Accepted Solution

by:
TinTombStone earned 250 total points
ID: 35044649
Assuming your table is called Customer and the field is named Name then the following gives you a few alternatives

SELECT customer.NAME, Left([name],InStr([name],"/")-1) AS LeftSide, Right([name],Len([name])-InStr([name],"/")) AS RightSide, Left([name],InStr([name],"/")) AS [LeftSideWith/], Right([name],Len([name])-InStr([name],"/")+1) AS [RightSideWith/]
FROM customer;
0
 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 250 total points
ID: 35044672
How about this:

SELECT CustomerT.CustomerID, IIf(InStr(1,[CustomerName],"/")>0,Left([CustomerName],InStr(1,[CustomerName],"/")-1),[CustomerName]) AS Expr1, CustomerT.CustomerName
FROM CustomerT;

mx
0
 

Author Comment

by:bill201
ID: 35045010
databasemx

how i can to get the customerid from the name that is in expr1?
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question