Solved

sql 2005 category number

Posted on 2008-06-12
7
155 Views
Last Modified: 2010-03-19
i have a get a result where it shows the top category like

cellularaccessories motorola faceplate ki krzr
i am looking only for cellular accessories how can i get that.

my data structure is like this
CategoryNumber CategoryName

101010		CellularAccessories

10101010	         FacePlates

1010101010	FaceplatesAM

101020		cellcards

10102010	         cellcards1

1010201010	cellcardsam
 
 

gpid	pidentifier	categorynumber	description

3013	CAFPMI000054	1010101010	MOTOROLA FACEPLATE K1 KRZR

3171	CAFPTM000063    1010201010	productcellcaram1

3172	CAFPTM000066    1010201020	productcellcaram2

3173	CAFPTM000067    1010201020	productcellcaram3

Open in new window

0
Comment
Question by:romeiovasu
  • 3
  • 3
7 Comments
 
LVL 60

Expert Comment

by:chapmandew
Comment Utility
select * from yoursecondtableinyourexample
where categorynumber = 101010
0
 
LVL 19

Expert Comment

by:elimesika
Comment Utility
Assuming that the upper table is A and the lower is B

select description fro B where categorynumber  = 101010          
0
 

Author Comment

by:romeiovasu
Comment Utility
sorry i got the query by myself the query is
SELECT * FROM arjayiqm.arjaytelecom.dbo.iQclerk_GlobalProducts WHERE LEFT(categorynumber,6) = '101010'

so i am not allocating any points for anybody.
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:romeiovasu
Comment Utility
thanks
0
 
LVL 19

Accepted Solution

by:
elimesika earned 500 total points
Comment Utility
HI again

The following solution is more efficient, since it will use your indexes while the solution that you have suggested does a TABLE SCAN
SELECT * FROM arjayiqm.arjaytelecom.dbo.iQclerk_GlobalProducts WHERE categorynumber,6 like '101010%'

Open in new window

0
 
LVL 19

Expert Comment

by:elimesika
Comment Utility
sorry , paste mistake , it should be :
SELECT * FROM arjayiqm.arjaytelecom.dbo.iQclerk_GlobalProducts WHERE categorynumber like '101010%'

Open in new window

0
 

Author Comment

by:romeiovasu
Comment Utility
thank you
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

728 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now