Mysql: using IN returns only one rows whereas individual query running perfect?

Your second query IS the optimized way. Just make sure you have an index on table_customized_fields_data. Incident_id.

Your second query IS the optimized way. Just make sure you have an index on table_customized_fields_data. Incident_id.

Also I think you have misunderstood how IN works, quote from the manual: expr IN (value,...) Returns 1 if expr is equal to any of the values in the IN list, else returns 0... so your tcfd. Id IN (ti. Customized_fields_id) is equivalent to: tcfd.Id = ti.

Customized_fields_id.

– diEcho Aug 17 at 10:13 all data means 4 rows. Which operator I have to use? – diEcho Aug 17 at 10:15.

Ti. Customized_fields_id is a string, not an array. It's not matching, but you're getting one row because it's a left join and it's mysql.

What you want is something like this: SELECT ti. Id IncID,tcf. Id labelID,tcfd.Id dataID,tcf.

Label, tcfd. Value FROM table_customized_fields_data tcfd INNER JOIN table_incident ti ON ti.Id = tcfd. Incident_id AND concat(',', customized_fields_id, ',') like concat('%,', tcfd.

Id, ',%') INNER JOIN table_customized_fields tcf ON tcf.Id = tcfd. Field_id WHERE ti. Id=47614 which says tcfd.Id is in the string customized_fields_id when delimited by commas.

Bohemian..but using % can be dangerous, there are 1000 of data which intial starts with same number – diEcho Aug 17 at 10:10 @bohemian..your suggested query is not working either – diEcho Aug 17 at 10:12 Try it now. Also, is it returning nothing? Too many rows?

– Bohemian Aug 17 at 10:24 it Returns last 3 rows only. Can't we change the datatype using CAST before IN – diEcho Aug 17 at 10:41.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions