Solved

sql 2005 category number

Posted on 2008-06-12
7
185 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
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

861 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