Click here to Skip to main content
15,886,919 members
Home / Discussions / Database
   

Database

 
QuestionManaging Database Changes Pin
Kevin Marois8-Nov-17 5:04
professionalKevin Marois8-Nov-17 5:04 
AnswerRe: Managing Database Changes Pin
David Mujica8-Nov-17 5:53
David Mujica8-Nov-17 5:53 
AnswerRe: Managing Database Changes Pin
jschell8-Nov-17 7:33
jschell8-Nov-17 7:33 
AnswerRe: Managing Database Changes Pin
Mycroft Holmes8-Nov-17 14:10
professionalMycroft Holmes8-Nov-17 14:10 
AnswerRe: Managing Database Changes Pin
kmoorevs11-Nov-17 9:58
kmoorevs11-Nov-17 9:58 
GeneralRe: Managing Database Changes Pin
Richard Deeming13-Nov-17 1:49
mveRichard Deeming13-Nov-17 1:49 
GeneralRe: Managing Database Changes Pin
kmoorevs13-Nov-17 8:29
kmoorevs13-Nov-17 8:29 
QuestionGet specific records from DB Pin
_Flaviu28-Oct-17 23:08
_Flaviu28-Oct-17 23:08 
I have the following tables and values:
SQL
t_cars
--------------------------------------------------------------------
nCars_ID	sName		sModel		        sIdentifier
--------------------------------------------------------------------
1		BMW		3 series	        D-78-JHG
2		Volvo		C30			B-56-KHT
3		Fiat		Doblo		        H-72-ABN
4		Volvo		C40			J-78-YTR


t_feature
-------------------------------
nFeature_ID		sName
-------------------------------
1			CMC
2			Doors
3			Color
4			Type
5			Weight
6			Engine
7			Power


t_cars_feature
-----------------------------------------------------------------------------------------------
nCarsFeature_ID	                nCars_ID	        nFeature_ID	               sValue
-----------------------------------------------------------------------------------------------
1				2			1				2500
2				2			2				5
3				2			4				Diesel
4				2			3				Green
5				3			1				1900
6				3			2				3
7				3			4				Otto
8				3			5				2300 KG
9				1			1				1900
10				1			3				Blue
11				1			4				Diesel
12				1			5				2100 KG


I need to retrieve from DB the cars that has CMC feature, has Color feature, AND CMC = 1900 AND Color = 'Blue' ONLY

I have tried:
SELECT t_cars.sName, t_cars.sModel, t_cars.sIdentifier
FROM t_cars, t_feature, t_cars_feature
WHERE t_feature.nFeature_ID = t_cars_feature.nFeature_ID
AND t_cars.nCars_ID = t_cars_feature.nCars_ID
AND [/*condition that get me cars that has CMC feature, has Color feature, AND CMC = 1900 AND Color = 'Blue' ONLY*/]

I have tried the condition like that:
Trial 1:

AND t_feature.sName = 'CMC'
AND t_feature.sName = 'Color'
AND t_cars_feature.sValue = '1900'
AND t_cars_feature.sValue = 'Blue'

and get me nothing

I have also tried:
Trial 2:

AND t_feature.sName IN ('CMC','Color')
AND t_cars_feature.sValue IN ('1900','Blue')

and get me all records that has CMC 1900 OR color 'Blue' (probably I got here cartesian product)

In real situation I could have several t_feature.sName values, and several t_cars_feature.sValue values, that is why trial 1 are not suitable for me ...

Can you help me ? Thank you.
AnswerRe: Get specific records from DB Pin
A_Griffin28-Oct-17 23:48
A_Griffin28-Oct-17 23:48 
AnswerRe: Get specific records from DB Pin
Mycroft Holmes28-Oct-17 23:54
professionalMycroft Holmes28-Oct-17 23:54 
QuestionA question about the behavior of Jet and Ace drivers Pin
indian14324-Oct-17 7:58
indian14324-Oct-17 7:58 
GeneralRe: A question about the behavior of Jet and Ace drivers Pin
PIEBALDconsult24-Oct-17 8:32
mvePIEBALDconsult24-Oct-17 8:32 
GeneralRe: A question about the behavior of Jet and Ace drivers Pin
indian14325-Oct-17 7:15
indian14325-Oct-17 7:15 
GeneralRe: A question about the behavior of Jet and Ace drivers Pin
jschell27-Oct-17 7:43
jschell27-Oct-17 7:43 
QuestionMath expression as Column value as string in the Dynamic Sql Pin
indian14319-Oct-17 7:19
indian14319-Oct-17 7:19 
GeneralRe: Math expression as Column value as string in the Dynamic Sql Pin
Richard MacCutchan19-Oct-17 7:33
mveRichard MacCutchan19-Oct-17 7:33 
GeneralRe: Math expression as Column value as string in the Dynamic Sql Pin
indian14319-Oct-17 8:10
indian14319-Oct-17 8:10 
GeneralRe: Math expression as Column value as string in the Dynamic Sql Pin
jschell20-Oct-17 9:27
jschell20-Oct-17 9:27 
GeneralRe: Math expression as Column value as string in the Dynamic Sql Pin
Eddy Vluggen20-Oct-17 10:47
professionalEddy Vluggen20-Oct-17 10:47 
GeneralRe: Math expression as Column value as string in the Dynamic Sql Pin
indian14324-Oct-17 6:41
indian14324-Oct-17 6:41 
GeneralRe: Math expression as Column value as string in the Dynamic Sql Pin
jschell25-Oct-17 9:19
jschell25-Oct-17 9:19 
GeneralRe: Math expression as Column value as string in the Dynamic Sql Pin
indian14330-Oct-17 7:37
indian14330-Oct-17 7:37 
QuestionGUID or long for MVC site Pin
#realJSOP17-Oct-17 6:37
mve#realJSOP17-Oct-17 6:37 
AnswerRe: GUID or long for MVC site Pin
Wendelius17-Oct-17 7:01
mentorWendelius17-Oct-17 7:01 
AnswerRe: GUID or long for MVC site Pin
jschell17-Oct-17 7:43
jschell17-Oct-17 7:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.