ورود

View Full Version : کوئری



لاله86
سه شنبه 04 تیر 1387, 11:05 صبح
سلام
میشه یکی به من بگه اشکال کارم چیه؟ به محض اینکه t_asib.number رو توی قسمتselect ضافه میکنم ایراد میگیره


tarikh.SQL.Add(' SELECT Max(t_asib.tzm) AS MaxOftzm, Max(t_asib.tmm) AS MaxOftmm,');
tarikh.SQL.Add(' Max(t_asib.tmam) AS MaxOftmam, Max(t_asib.tzf) AS MaxOftzf, Max(t_asib.tmf) AS MaxOftmf,');
tarikh.SQL.add('Max(t_asib.tmaf) AS MaxOftmaf, Max(t_asib.senmaxasib) AS MaxOfsenmaxasib,');
tarikh.SQL.Add(' Min(t_asib.senminasib) AS MinOfsenminasib, Max(t_asib.senmaxf) AS MaxOfsenmaxf, Min(t_asib.senminf) AS MinOfsenminf');
tarikh.SQL.Add('FROM t_hadese INNER JOIN t_asib ON (t_hadese.number = t_asib.number)');
tarikh.SQL.Add(' where t_hadese.date between :p5 and :p6 ');
tarikh.Parameters.ParamByName ('p5').Value:= strtoint(e22.Text);
tarikh.Parameters.ParamByName('p6').Value :=strtoint (e23.Text);

delphiprog3000
سه شنبه 04 تیر 1387, 11:18 صبح
با سلام. دوست عزیز متن ایراد رو هم قرار میدادید؟

و کمی هم در مورد کاری که میخواهید انجام دهید توضیح دهید تا کاملتر بشه راهنمایی کرد!!!

لاله86
سه شنبه 04 تیر 1387, 12:27 عصر
سلام
این خطا رو میده:
you tried to execute a query that dos not include the spesified expession 'number' as part of an agreegate

Vahid_moghaddam
سه شنبه 04 تیر 1387, 12:47 عصر
به group by نیاز دارید. در select چیزی رو که می خواید اضافه کنید و در انتها بنویسید

group by t_asib.number

لاله86
سه شنبه 04 تیر 1387, 12:53 عصر
این کار رو کردم ولی بازم همون ایراد رو میگیره

farhad110
چهارشنبه 05 تیر 1387, 09:51 صبح
سلام. نام تمام فيلدهايي رو كه در دستور select داريد، در قسمت group by بنويسيد