Solved

sql 2005 category number

Posted on 2008-06-12
7
193 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 60

Expert Comment

by:chapmandew
ID: 21774403
select * from yoursecondtableinyourexample
where categorynumber = 101010
0
 
LVL 19

Expert Comment

by:elimesika
ID: 21774410
Assuming that the upper table is A and the lower is B

select description fro B where categorynumber  = 101010          
0
 

Author Comment

by:romeiovasu
ID: 21774733
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
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:romeiovasu
ID: 21774737
thanks
0
 
LVL 19

Accepted Solution

by:
elimesika earned 500 total points
ID: 21776320
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
ID: 21776329
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
ID: 21779234
thank you
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

726 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